From: Nobuyoshi Nakada Date: 2007-11-18T03:35:37+09:00 Subject: Re: Hash -> Struct Hi, At Sun, 18 Nov 2007 02:54:12 +0900, Robert Dober wrote in [ruby-talk:279478]: > On Nov 17, 2007 5:47 PM, Trans wrote: > > Given that a hash is not ordered, is this reliable? > > > > h = { :a=>1, :b=>2 } > > Struct.new(*h.keys).new(*h.values) > > => # a=1, b=2> > by definition not, I would never bet on it, Hash iterates in the definite order until it's modified, not at random each time. It's just hard to predict. So it should work if it's not modified between getting keys and values. -- Nobu Nakada