View on GitHub
Map the enumerable to the incremental state of a calculation by
applying the given block, in turn, to each element and the
previous state of the calculation, resulting in an enumerable of
the state after each iteration.
@return [Enumerable] Generate a stream of intermediate states
resulting from applying a binary operator. Equivalent to a
stream of +#inject+ calls on first N elements, increasing N from
zero to the size of the stream. NOTE: Preserves laziness if
+enumerable+ is lazy.
@param initial [Object] Initial state value to yield.
@yield [memo, obj] Invokes given block with previous state value
+memo+ and next element of the stream +obj+.
@yieldreturn [Object] The next state value for +memo+.