Skip to content

Instantly share code, notes, and snippets.

@sonkm3
Last active December 20, 2015 08:48
Show Gist options
  • Save sonkm3/6102746 to your computer and use it in GitHub Desktop.
Save sonkm3/6102746 to your computer and use it in GitHub Desktop.
ruby: hash.update()
hash1 = {:a=> 1, :b=>2}
hash2 = {}
hash2[:b] = 3
p hash2
hash2.update(hash1)
p hash2
#{:b=>3}
#{:a=>1, :b=>2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment