DevHeads.net

Reply to comment

[ruby-trunk - Feature #5766][Closed] Hash.each

By Urabe Shyouhei at 12/15/2011 - 11:32

Issue #5766 has been updated by Shyouhei Urabe.

Status changed from Open to Closed

Author: Rodrigo Rosenfeld Rosas
Status: Closed
Priority: Normal
Assignee:
Category:
Target version:

Enum.each_with_object is very handy in lots of situations, but specially while dealing with arrays. It would be great to be able to use it with hashes like below:

{a: 1}.each_with_object([]){|k, v, object| ...}

Currently, we need to do

{a: 1}.each_with_object([]) do |pair, object|
k, v = pair
...
end

Reply

Image CAPTCHA