Array.reduce will inject and initial value into a block and pass in each value in turn until all values in the array has been iterated i.e
([1] * 10).reduce(0) { |total, current_value| total + current_value } #= 10
# Inject does the same
([1] * 10).inject(0) { |total, current_value| total + current_value } #= 10
However, if we simply require a sum of all values in the array, we can take advantage of Symbol#to_proc as follows: