Class: Arrest::NestedAttribute
- Defined in:
- lib/arrest/attributes/nested_attribute.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Attribute
#actions, #clazz, #dirty, #json_name, #name
Instance Method Summary collapse
- #from_hash(parent, value) ⇒ Object
-
#initialize(name, clazz, options) ⇒ NestedAttribute
constructor
A new instance of NestedAttribute.
- #to_hash(val) ⇒ Object
Methods inherited from Attribute
#dirty?, #mutable?, #read_only?
Constructor Details
#initialize(name, clazz, options) ⇒ NestedAttribute
Returns a new instance of NestedAttribute.
3 4 5 |
# File 'lib/arrest/attributes/nested_attribute.rb', line 3 def initialize name, clazz, super name, clazz, end |
Instance Method Details
#from_hash(parent, value) ⇒ Object
7 8 9 10 |
# File 'lib/arrest/attributes/nested_attribute.rb', line 7 def from_hash(parent, value) return nil unless value != nil @clazz.new(parent, value) end |
#to_hash(val) ⇒ Object
12 13 14 15 |
# File 'lib/arrest/attributes/nested_attribute.rb', line 12 def to_hash val return nil unless val!= nil val.to_hash end |