O'Reilly logo
  • Ronald Cosentino thinks this is interesting:

We call the keys method on the my_own_menu hash to get our keys, then immediately call each on those keys to iterate over them. (Remember that from Chapter 5? Feel free to look back if you need a reminder.)

Here’s the really cool part: for each key in the hash, we call delete on the key (which removes it from the hash), but since delete returns the value associated with the key that was deleted, we immediately set this equal to calling to_sym


Cover of Ruby Wizardry


Important. shows you how to change the string keys to symbol keys thru saving a ton of memory.