The documentation says:
each_with_object(obj) → an_enumerator
Iterates the given block for each element with an arbitrary object given, and returns the initially given object.
If no block is given, returns an enumerator.
Since Array is the same source object, but with changed values, is returned in this case.
If we see the code of each_with_object, this is:
def each_with_object(memo)
return to_enum :each_with_object, memo unless block_given?
each do |element|
yield element, memo
end
memo
end
, , , memo 0 , , [] , .