From: Siep Korteling Date: 2008-10-02T06:58:00+09:00 Subject: Re: Ordered hash hack for < ruby 1.9? Ben Johnson wrote: > Lex Williams wrote: >> this sorts them alphabetically , not by insertion order. > > I didn't need them by insertion order, just to be consistent. I > apologize if I made that unclear. > > Also, I am not testing a hash, I am testing a method that returns a > string. That string is built by iterating over a hash. > > Thanks. This code fills a hash and then iterates the hash to build a string. h={} ("a".."z").each{|i| h[i] = i} 10.times do res = h.inject(""){|str, pair| str<