I recently needed to print the information in a Ruby hash, with the results sorted by value. Here's a general recipe on how to print the hash results sorted by value. I've created a sample hash, and populated the hash with sample data, to show how this works.
First, here's the sample code, using the first name of each person as the key, and the last name as the value of the key/value pair: