Skip to content

Instantly share code, notes, and snippets.

@jonhinson
Forked from chadhutchins/gist:558942
Created August 31, 2010 13:41
Show Gist options
  • Save jonhinson/559029 to your computer and use it in GitHub Desktop.
Save jonhinson/559029 to your computer and use it in GitHub Desktop.
default = {
"key1" => "val1",
"key2" => "val2",
"key3" => {
"1" => "one",
"2" => "two"
},
"key4" => "four"
}
custom = {
"key1" => "val1",
"key2" => "newval",
"key3" => {
"1" => "one",
"2" => "too"
}
}
result = default.merge custom
# >> result
# => {"key1"=>"val1", "key2"=>"newval", "key3"=>{"1"=>"one", "2"=>"too"}, "key4"=>"four"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment