Class: Arrest::PolymorphicAttribute

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

Instance Attribute Summary

Attributes inherited from Attribute

#actions, #dirty, #json_name, #name

Instance Method Summary collapse

Methods inherited from NestedAttribute

#to_hash

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