Skip to content

Instantly share code, notes, and snippets.

@af23me
Created March 23, 2017 16:24
Show Gist options
  • Save af23me/0ace678198fe33dca22e80bb3e246ef5 to your computer and use it in GitHub Desktop.
Save af23me/0ace678198fe33dca22e80bb3e246ef5 to your computer and use it in GitHub Desktop.
Merge hash recursively
def merge_hash_recursively(first_hash, second_hash)
first_hash.merge(second_hash) { |key, a_item, b_item| merge_hash_recursively(a_item, b_item) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment