Revert "Merge pull request #41931 from MarcelEeken/deep-merge-changing-original-hash"

This reverts commit 483d36ae09, reversing
changes made to b171b842da.
This commit is contained in:
Jean Boussier 2021-04-13 12:12:03 +02:00
parent d75dc72922
commit 8d34f769ce
3 changed files with 1 additions and 15 deletions

View File

@ -13,10 +13,6 @@
*Andrew White*
* Fix issue in `Hash#deep_merge` where it did not properly duplicate a nested `Hash`
*Marcel Eeken*
* Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
```ruby

View File

@ -16,7 +16,7 @@ class Hash
# h1.deep_merge(h2) { |key, this_val, other_val| this_val + other_val }
# # => { a: 100, b: 450, c: { c1: 300 } }
def deep_merge(other_hash, &block)
deep_dup.deep_merge!(other_hash, &block)
dup.deep_merge!(other_hash, &block)
end
# Same as +deep_merge+, but modifies +self+.

View File

@ -300,16 +300,6 @@ class HashExtTest < ActiveSupport::TestCase
assert_equal expected, hash_1
end
def test_deep_merge_with_nested_hash_returning_full_new_hash
hash_1 = { a: { b: "foo" } }
hash_2 = { d: "bar" }
new_hash = hash_1.deep_merge(hash_2)
new_hash[:a][:b] = "baz"
assert_equal("foo", hash_1[:a][:b])
end
def test_reverse_merge
defaults = { d: 0, a: "x", b: "y", c: 10 }.freeze
options = { a: 1, b: 2 }