Skip to content

Instantly share code, notes, and snippets.

@julioterra
Created October 3, 2011 17:48
Show Gist options
  • Select an option

  • Save julioterra/1259743 to your computer and use it in GitHub Desktop.

Select an option

Save julioterra/1259743 to your computer and use it in GitHub Desktop.
merging and updating hashes
hash_1 = {:fruit => "banana", :vegetable => "tomato", :starch => "rice"}
hash_2 = {:meat => "chicken breast", :candy => "chocolate", :fruit => "strawberry"}
hash_3 = hash_1.merge(hash_2)
hash_1.update(hash_2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment