module Hashie::Extensions::Coercion
@example Coerce assigned values
class Person < Hash include Hashie::Extensions::Coercion coerce_key :age, Integer end person = Person.new person[:age] = '42' person[:age] # => 42
Constants
- ABSTRACT_CORE_TYPES
- CORE_TYPES
Public Class Methods
included(base)
click to toggle source
# File lib/hashie/extensions/coercion.rb, line 40 def self.included(base) base.send :include, InstanceMethods base.extend ClassMethods base.send :alias_method, :set_value_without_coercion, :[]= unless base.method_defined?(:set_value_without_coercion) base.send :alias_method, :[]=, :set_value_with_coercion end