src code

instance method Enumerable#inject

Enumerable#inject(accumulator, iterator[, context]) → accumulatedValue

Incrementally builds a result value based on the successive results of the iterator. This can be used for array construction, numerical sums/averages, etc.