From: Yossef Mendelssohn Date: 2007-09-13T23:50:46+09:00 Subject: Re: Merge an array of hashes On Sep 13, 1:10 am, Rub�n Medell�n wrote: > > Hash[*a.collect {|h| h.to_a}.flatten] > > I wouldn't recommend this. > > a = [{:an_array => [1,2,3,4]}, {:another_array => [5,6,7,8]}] > Hash[*a.collect {|h| h.to_a}.flatten] > > => { :an_array => 1, 2 => 3, 4 => :another_array, 5 => 6, 7 => 8 } > > There is no problem of course if there are no lists in the hash. 2 is 3, 5 is 6, and 7 is 8? My entire worldview has gone topsy-turvy. -- -yossef