Archive for November, 2009

sort a ruby hash

Posted in ruby on November 30th, 2009 by paul – Be the first to comment

A neat way to sort a hash

my_hash.keys.sort_by {|s| s.to_s}.map {|key| [key, my_hash[key]] }

found here