with_object(p1) public

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.

Show source
Register or log in to add new notes.
February 3, 2013 - (v1_9_3_125)
0 thanks

Difference between enum#with_object and enum#each_with_object

I found a very good post on SO - which clearly explained the difference between enum#with_object and enum#each_with_object. The link is as follows:

http://stackoverflow.com/questions/14671881/how-does-enumwith-object-differ-from-enumeach-with-object/14672305#14672305