Saving for later:

a = Hash.new(0)
a[4]=2
a[1]=3
a[555] = 20
a.sort_by {|k,v| v}.reverse
=> [[555, 20], [1, 3], [4, 2]]

Leave a comment on github