From: Ryan Davis Date: 2007-11-19T16:03:20+09:00 Subject: Re: Hash -> Struct On Nov 17, 2007, at 10:35 , Nobuyoshi Nakada wrote: >>> 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. Kinda makes me want a flag or environment variable that WILL iterate through a hash randomly every time... ruby --pain hash_to_struct.rb should fail every time as written above. It would help drive out a number of subtle and damn hard to debug bugs out there.