Skip to content

Commit

Permalink
remove confusing deep_merge
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed May 16, 2024
1 parent 8084400 commit e9fefb5
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 16 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* removed deep_merge and deeper_merge, if you used them replace with `!` variant with `preserve_unmergeables: true`
* Dropped support for ruby versions before 2.7

2022-01-07 Jason Frey <[email protected]>
Expand Down Expand Up @@ -64,7 +65,7 @@

2010-01-11 Dan DeLeo <[email protected]>

* fix boolean merging according to mdkent's patch explicitly test
* fix boolean merging according to mdkent's patch explicitly test
for nils w/ #nil? instead of negating. Thanks mdkent!

2009-12-25 Dan DeLeo <[email protected]>
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ In a Gemfile:

The deep_merge methods will then be defined as

Hash#deeper_merge
Hash#deeper_merge!
Hash#ko_deeper_merge!

Expand Down
7 changes: 0 additions & 7 deletions lib/deep_merge/deep_merge_hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ def deep_merge!(source, options = {})
default_opts = {:preserve_unmergeables => false}
DeepMerge::deep_merge!(source, self, default_opts.merge(options))
end

# deep_merge will merge and skip any unmergeables in destination hash
def deep_merge(source, options = {})
default_opts = {:preserve_unmergeables => true}
DeepMerge::deep_merge!(source, self, default_opts.merge(options))
end

end # DeepMergeHashExt
end

Expand Down
6 changes: 0 additions & 6 deletions lib/deep_merge/rails_compat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ def deeper_merge!(source, options = {})
default_opts = {:preserve_unmergeables => false}
DeepMerge::deep_merge!(source, self, default_opts.merge(options))
end

# deeper_merge will merge and skip any unmergeables in destination hash
def deeper_merge(source, options = {})
default_opts = {:preserve_unmergeables => true}
DeepMerge::deep_merge!(source, self, default_opts.merge(options))
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/test_deep_merge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_hash_deep_merge

hash_src = {'id' => 'xxx'}
hash_dest = {'id' => [1,2,3]}
assert hash_dest.deep_merge(hash_src)
assert hash_dest.deep_merge!(hash_src, preserve_unmergeables: true)
assert_equal({'id' => [1,2,3]}, hash_dest)
end

Expand Down

0 comments on commit e9fefb5

Please sign in to comment.