From: Jeff Date: 2007-09-18T12:09:02+09:00 Subject: Re: Is there a select and map for hashes instead of arrays? On Sep 17, 8:35 pm, franco wrote: > # use two vars in an map/select block (or use the index if one var) > array = {:a => 1, :b =>2}.select {|k,v| k == :b} > # => [[:b, 2]] > > # use inject to make a hash from a list, this is a great technique > hash = array.inject({}) {|h,e| h.merge({e[0] => e[1]}) } > # => {:b=>2} > > -franco That was exactly my point - why doesn't Hash#select and Hash#map return hashes instead of arrays? Jeff