Class: Arrest::PolymorphicAttribute

Inherits:
NestedAttribute show all
Defined in:
lib/arrest/attributes/polymorphic_attribute.rb

Instance Attribute Summary

Attributes inherited from Attribute

#actions, #clazz, #dirty, #json_name, #name

Instance Method Summary collapse

Methods inherited from NestedAttribute

#to_hash

Methods inherited from Attribute

#dirty?, #mutable?, #read_only?, #to_hash

Constructor Details

#initialize(name, actions) ⇒ PolymorphicAttribute

Returns a new instance of PolymorphicAttribute.



18
19
20
# File 'lib/arrest/attributes/polymorphic_attribute.rb', line 18

def initialize name, actions
  super name, Ref, actions
end

Instance Method Details

#from_hash(parent, value) ⇒ Object



22
23
24
25
# File 'lib/arrest/attributes/polymorphic_attribute.rb', line 22

def from_hash(parent, value)
  return nil unless value != nil
  @clazz.new(value)
end