Re: Sorting with Hash


#1

Hi Dinesh!

h = { “c” => 20, “b” => 30, “a” => 10 }
c = h.keys.sort.map{|k| [k, h[k]]}

puts c
puts ‘=======’
puts c[0]

cheers

Simon