From: Ben Johnson Date: 2008-10-02T03:13:55+09:00 Subject: Re: Ordered hash hack for < ruby 1.9? Patrick Doyle wrote: > Why not iterate over myhash.keys.sort instead of just myhash.keys? > > --wpd Because for performance it's bad. I don't care if performance is bad in my tests. Which is why it would be nice to alter how hashes work ONLY in my test environment. But sorting by keys isn't smart either. >> a = {:a => 1, :b => 2} => {:a=>1, :b=>2} >> a.keys.sort NoMethodError: undefined method `<=>' for :a:Symbol from (irb):16:in `sort' from (irb):16 from :0 -- Posted via http://www.ruby-forum.com/.