instance method
update
Ruby on Rails 3.2.22.5
Since v3.0.20Signature
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 70
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 70
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::HashWithIndifferentAccess