A neat way to sort a hash
my_hash.keys.sort_by {|s| s.to_s}.map {|key| [key, my_hash[key]] }
found here
Tags: hash, ruby, sort
This entry was posted on Monday, November 30th, 2009 at 8:01 pm and is filed under ruby. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Name (required)
Mail (will not be published) (required)
Website