No release in over 3 years
Low commit activity in last 3 years
Extends Rails's deep_merge method to merge only existing keys.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 13.0
~> 3.0

Runtime

>= 5.2
 Project Readme

DeepMergeExistingKeys

Extends Rails's deep_merge method to merge only existing keys.

Installation

Add this line to your application's Gemfile:

gem 'deep_merge_existing_keys'

And then execute:

$ bundle

Or install it yourself as:

$ gem install deep_merge_existing_keys

Usage

old_hash = { a: 10, b: 20, c: { c1: 30, c2: { c2a: 40 } } }
new_hash = { b: 25, c: { c1: 35, c2: { c2b: 55 } }, d: 65 }

merged_hash = old_hash.deep_merge_existing_keys new_hash
merged_hash # { a: 10, b: 25, c: { c1: 35, c2: { c2a: 40 } }

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/lespoupeesrusses/deep_merge_existing_keys. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the DeepMergeExistingKeys project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.