From: Rodrigo Rosenfeld Rosas Date: 2011-12-15T20:50:49+09:00 Subject: [ruby-core:41676] Re: [ruby-trunk - Feature #5766][Open] Hash.each_with_object should behave differently when block's arity is 3 Em 15-12-2011 03:14, Yukihiro Matsumoto escreveu: > Hi, > > In message "Re: [ruby-core:41668] [ruby-trunk - Feature #5766][Open] Hash.each_with_object should behave differently when block's arity is 3" > on Thu, 15 Dec 2011 13:07:22 +0900, Rodrigo Rosenfeld Rosas writes: > > |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| ...} > > Try > > {a: 1}.each_with_object([]){|(k, v), object| ...} Great, thanks Matz! I didn't know that. I had tried {|[k, v], object|} before but haven't think about the parenthesis :)