module Hashie::Extensions::Coercion::InstanceMethods
Public Instance Methods
[]=(key, value)
click to toggle source
Calls superclass method
# File lib/hashie/extensions/coercion.rb, line 10 def []=(key, value) into = self.class.key_coercion(key) || self.class.value_coercion(value) if value && into if into.respond_to?(:coerce) value = into.coerce(value) else value = into.new(value) end end super(key, value) end
custom_writer(key, value, convert = true)
click to toggle source
# File lib/hashie/extensions/coercion.rb, line 24 def custom_writer(key, value, convert = true) self[key] = value end
replace(other_hash)
click to toggle source
# File lib/hashie/extensions/coercion.rb, line 28 def replace(other_hash) (keys - other_hash.keys).each { |key| delete(key) } other_hash.each { |key, value| self[key] = value } self end