Sorting a 2-D hash in reverse order

Posted by Shreyas Satish on Stack Overflow See other posts from Stack Overflow or by Shreyas Satish
Published on 2010-04-27T18:00:39Z Indexed on 2010/04/27 18:03 UTC
Read the original article Hit count: 368

Filed under:
|
|

I have a 2-d hash.I need to sort each sub-hash by value in descending order.

hsh={"a"=>{0=>1, 1=>2}}

output= {"a"=>{1=>2,0=>1}}

Thanks & Cheers !

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about hash