Hi,
In mail "[ruby-talk:30336] OT: Re: Sorting a Hash by value of integer stored in the Hash"
Michal Rokos <rokosm / klokan.sh.cvut.cz> wrote:
> > ary = [["x", 3], ["z", 5], ["y", 7]]
> ^^^^^^^
> Is there any "automatic" way to create hash from ary (above). I
> didn't find any. (I know hash = Hash[[1,2,3,4]], but I doesn't
> work for this)
Try this:
Hash[ *ary.flatten ]
-- Minero Aoki