Module: Hashie::Extensions::Coercion
- Defined in:
- lib/hashie/extensions/coercion.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Constant Summary collapse
- CORE_TYPES =
{ Integer => :to_i, Float => :to_f, Complex => :to_c, Rational => :to_r, String => :to_s, Symbol => :to_sym }
- ABSTRACT_CORE_TYPES =
{ Integer => [Fixnum, Bignum], Numeric => [Fixnum, Bignum, Float, Complex, Rational] }
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/hashie/extensions/coercion.rb', line 20 def self.included(base) base.send :include, InstanceMethods base.extend ClassMethods # NOTE: we wanna make sure we first define set_value_with_coercion before extending 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 |