diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/hash/reverse_merge.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/reverse_merge.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb b/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb index 061c959442..ef8d592829 100644 --- a/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +++ b/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Hash # Merges the caller into +other_hash+. For example, # @@ -16,8 +18,7 @@ class Hash # Destructive +reverse_merge+. def reverse_merge!(other_hash) - # right wins if there is no left - merge!(other_hash) { |key, left, right| left } + replace(reverse_merge(other_hash)) end alias_method :reverse_update, :reverse_merge! alias_method :with_defaults!, :reverse_merge! |