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