From: Joel VanderWerf Date: 2010-08-19T16:07:49+09:00 Subject: Re: Hashes in 1.9 index On 08/18/2010 09:28 PM, Iain Barnett wrote: > Since hashes in 1.9 retain their insert order, is there a built in way to get values by index as well as key? > > For example: > h = { a: 17, b: 18, c: 19 } > > puts h[1] > => 19 Not much better than using #each_with_index or #to_a: >> h = { a: 17, b: 18, c: 19 } => {:a=>17, :b=>18, :c=>19} >> h[h.keys[1]] => 18