Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created March 28, 2019 17:14
Show Gist options
  • Save joegaudet/4b6069bd7b0ab2544278989bffc80d44 to your computer and use it in GitHub Desktop.
Save joegaudet/4b6069bd7b0ab2544278989bffc80d44 to your computer and use it in GitHub Desktop.
Hash Conflict Resolution
hash_a = {foo: 'bar', baz: 'qux'}
hash_b = {foo: 'baz'}
hash_c = hash_a.merge(hash_b) do |key, old, new|
[old, new]
end
hash_c == {
foo: ['bar', 'baz'],
baz: 'qux'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment