instance method
update
Ruby on Rails 3.1.12
Since v2.2.3 Last seen in v4.2.9Signature
update(other_hash)
Updates the instantized hash with values from the second:
hash_1 = HashWithIndifferentAccess.new hash_1[:key] = "value" hash_2 = HashWithIndifferentAccess.new hash_2[:key] = "New Value!" hash_1.update(hash_2) # => {"key"=>"New Value!"}
Parameters
-
other_hashreq
Source
# File activesupport/lib/active_support/hash_with_indifferent_access.rb, line 66
def update(other_hash)
if other_hash.is_a? HashWithIndifferentAccess
super(other_hash)
else
other_hash.each_pair { |key, value| regular_writer(convert_key(key), convert_value(value)) }
self
end
end
Defined in activesupport/lib/active_support/hash_with_indifferent_access.rb line 66
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in HashWithIndifferentAccess