From: "Iñaki Baz Castillo" Date: 2010-01-21T22:46:48+09:00 Subject: Re: Unexpected Hash#first return under Ruby1.9 El Jueves, 21 de Enero de 2010, Jeff Peng escribió: > 在 2010-01-21四的 22:22 +0900,Iñaki Baz Castillo写道: > > > Hi, Ruby 1.9 implements "first" method for Hash (as Hash are ordered > > now). However the return value if a bit annoying for me. A real example: > > > > irb> h = {"aaa"=>"AAA", "bbb"=>"BBB"} > > irb> h.first > > ["aaa", "AAA"] > > Since the result is an array you can access its element with the array > way: > > irb(main):007:0> h.first[1] > => "AAA" Sure. I just expected Hash#first returning the first valule rather than the first [key,value] entry. -- Iñaki Baz Castillo