From: sto.mar@... Date: 2012-10-21T02:52:22+09:00 Subject: Re: Hash with Integer key issue Am 20.10.2012 18:23, schrieb 7stud --: >> Arlen already told you! >> >> new_hash = Hash[x.sort_by {|k,v| v }.reverse] >> >> But I do not see the use case for a sorted hash, >> it appears conceptually wrong to me. Have you read Jan's post? >> > > If you believe Hashes are unsorted, then why would you reverse an array > before converting it to a Hash? Have you read the previous posts in this thread? The code above was given in reply to the OP's question, and it works as expected in Ruby 1.9.3 because hashes are indeed sorted there. (It probably should have been mentioned that it fails in Ruby 1.8). What I did want to point out is that I do not see why a hash is used here, when order seems to be crucial to the OP's purposes. --