From: "Iñaki Baz Castillo" Date: 2011-06-22T01:12:43+09:00 Subject: Re: How to order a hash based on its keys? 2011/6/21 Vikhyat Korrapati : > Hash[h.sort] seems to be the best way. It adds a bit overhead (of course): irb> h = {"a"=>1, "c"=>3, "b"=>2, "d"=>4} irb> Benchmark.realtime { 100000.times { h.sort } } 0.787590503692627 irb> Benchmark.realtime { 100000.times { Hash[h.sort] } } 1.1099345684051514 But seems good enough :) -- Iñaki Baz Castillo