From: Bob Showalter Date: 2007-09-13T04:02:22+09:00 Subject: Re: Merge an array of hashes On 9/12/07, cleaner416 wrote: > For some reason I can't get my head wrapped around this trivial > exercise. I have an array of hashes like so > > a = [ { :some_key => :some_value }, { :another_key > => :another_value } ] > > And I would like to flatten it to single hash in one line so I get > > { :some_key => :some_value, :another_key => :another_value } Hash[*a.collect {|h| h.to_a}.flatten]