Class: NestedRecord::Type
- Inherits:
-
ActiveRecord::Type::Json
- Object
- ActiveRecord::Type::Json
- NestedRecord::Type
- Defined in:
- lib/nested_record/type.rb,
lib/nested_record/type/one.rb,
lib/nested_record/type/many.rb
Defined Under Namespace
Instance Method Summary collapse
- #cast(data) ⇒ Object
- #deserialize(value) ⇒ Object
-
#initialize(setup) ⇒ Type
constructor
A new instance of Type.
- #serialize(obj) ⇒ Object
Constructor Details
#initialize(setup) ⇒ Type
Returns a new instance of Type.
7 8 9 |
# File 'lib/nested_record/type.rb', line 7 def initialize(setup) @setup = setup end |
Instance Method Details
#cast(data) ⇒ Object
11 12 13 |
# File 'lib/nested_record/type.rb', line 11 def cast(data) cast_value(data) end |
#deserialize(value) ⇒ Object
15 16 17 |
# File 'lib/nested_record/type.rb', line 15 def deserialize(value) cast_value(super) end |
#serialize(obj) ⇒ Object
19 20 21 |
# File 'lib/nested_record/type.rb', line 19 def serialize(obj) super(obj&.as_json) end |