Class: Arrest::PolymorphicAttribute
- Inherits:
-
NestedAttribute
- Object
- Attribute
- NestedAttribute
- Arrest::PolymorphicAttribute
- Defined in:
- lib/arrest/attributes/polymorphic_attribute.rb
Instance Attribute Summary
Attributes inherited from Attribute
#actions, #dirty, #json_name, #name
Instance Method Summary collapse
- #from_hash(parent, value) ⇒ Object
-
#initialize(name, actions) ⇒ PolymorphicAttribute
constructor
A new instance of PolymorphicAttribute.
Methods inherited from NestedAttribute
Methods inherited from Attribute
#clazz, #clazz=, #dirty?, #dirty_sensitive?, #mutable?, #read_only?, #to_hash
Constructor Details
#initialize(name, actions) ⇒ PolymorphicAttribute
Returns a new instance of PolymorphicAttribute.
19 20 21 |
# File 'lib/arrest/attributes/polymorphic_attribute.rb', line 19 def initialize name, actions super name, :'Ref', actions end |
Instance Method Details
#from_hash(parent, value) ⇒ Object
23 24 25 26 |
# File 'lib/arrest/attributes/polymorphic_attribute.rb', line 23 def from_hash(parent, value) return nil unless value != nil self.clazz.new(value) end |