Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/extensions/hash.rb
Instance Method Summary collapse
-
#reverse_merge(other_hash) ⇒ Object
Performs the opposite of merge, with the keys and values from the first hash taking precedence over the second.
-
#reverse_merge!(other_hash) ⇒ Object
Performs the opposite of merge, with the keys and values from the first hash taking precedence over the second.
Instance Method Details
#reverse_merge(other_hash) ⇒ Object
Performs the opposite of merge, with the keys and values from the first hash taking precedence over the second.
3 4 5 |
# File 'lib/extensions/hash.rb', line 3 def reverse_merge(other_hash) other_hash.merge(self) end |
#reverse_merge!(other_hash) ⇒ Object
Performs the opposite of merge, with the keys and values from the first hash taking precedence over the second. Modifies the receiver in place.
9 10 11 |
# File 'lib/extensions/hash.rb', line 9 def reverse_merge!(other_hash) replace(reverse_merge(other_hash)) end |