Class: ActiveRecord::AttributeMethods::Serialization::Type
- Defined in:
- activerecord/lib/active_record/attribute_methods/serialization.rb
Overview
:nodoc:
Instance Method Summary collapse
- #accessor ⇒ Object
-
#initialize(column) ⇒ Type
constructor
A new instance of Type.
- #type ⇒ Object
- #type_cast(value) ⇒ Object
Constructor Details
#initialize(column) ⇒ Type
Returns a new instance of Type.
73 74 75 |
# File 'activerecord/lib/active_record/attribute_methods/serialization.rb', line 73 def initialize(column) @column = column end |
Instance Method Details
#accessor ⇒ Object
89 90 91 |
# File 'activerecord/lib/active_record/attribute_methods/serialization.rb', line 89 def accessor ActiveRecord::Store::IndifferentHashAccessor end |
#type ⇒ Object
85 86 87 |
# File 'activerecord/lib/active_record/attribute_methods/serialization.rb', line 85 def type @column.type end |
#type_cast(value) ⇒ Object
77 78 79 80 81 82 83 |
# File 'activerecord/lib/active_record/attribute_methods/serialization.rb', line 77 def type_cast(value) if value.state == :serialized value.unserialized_value @column.type_cast value.value else value.unserialized_value end end |