From: sto.mar@... Date: 2012-10-20T22:01:10+09:00 Subject: Re: Hash with Integer key issue Am 20.10.2012 14:46, schrieb Wayne Simmerson: > Thanks for all the replies, I actually figured it out about 2 minutes > after I posted the question. I was banging my head against my desk for > hours trying to figure out why it wasn't working, completely oblivious > to the fact it had been converted to an Array. It took writing it out > here to notice the Hash had been Arrayed! > > Is there no way to sort the hash and convert it back in the same > statement? Would be nice to do in a single line of code. 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? --