From: Justin Collins Date: 2006-10-29T11:59:12+09:00 Subject: Re: hash.collect Joe Ruby MUDCRAP-CE wrote: > collect seems to work on a hash: > > h = {'a'=>'1', 'b'=>'2'} > > params = h.collect {|k, v| "#{k}=#{v}"}.join('&') > > Yet collect isn't listed as a method of hash: > http://www.ruby-doc.org/core > > Is it undocumented, or is some magic going on behind the scenes -- such > as the hash getting converted to an array? > > Thanks, > Joe > > No, no real magic: "collect" is part of the Enumerable module, which is mixed into Hash (and other things) and implements this functionality. -Justin [1]http://ruby-doc.org/core/classes/Enumerable.html