From: "Iñaki Baz Castillo" Date: 2011-06-21T23:34:16+09:00 Subject: How to order a hash based on its keys? Hi, I want to order a hash using itds keys: irb> a = { 2=>"2", 3=>"3", 1=>"1" } irb> a.sort [[1, "1"], [2, "2"], [3, "3"]] But I want a resulting hash with keys ordered: { 1=>"1", 2=>"2", 3=>"3"} Is there any efficiente way? (I don't want the hast to be converted to an array and the to a hash again). Thanks. -- Iñaki Baz Castillo