Class: Virtus::Attribute::EmbeddedValue::FromOpenStruct

Inherits:
Virtus::Attribute::EmbeddedValue show all
Defined in:
lib/virtus/attribute/embedded_value/from_open_struct.rb

Overview

EmbeddedValue attribute handling OpenStruct primitive or Virtus object

Constant Summary

Constants included from TypeLookup

TypeLookup::TYPE_FORMAT

Instance Attribute Summary

Attributes inherited from Virtus::Attribute

#coercion_method, #default, #name, #options

Instance Method Summary collapse

Methods inherited from Virtus::Attribute::EmbeddedValue

determine_type, merge_options

Methods inherited from Virtus::Attribute

build, #define_accessor_methods, #define_reader_method, #define_writer_method, determine_type, #get, #get!, #initialize, #inspect, merge_options, #public_reader?, #public_writer?, #set, #set!, #value_coerced?

Methods included from TypeLookup

#determine_type, extended, #primitive

Methods included from Options

#accept_options, #accepted_options, #options

Constructor Details

This class inherits a constructor from Virtus::Attribute

Instance Method Details

#coerce(attributes) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
13
14
# File 'lib/virtus/attribute/embedded_value/from_open_struct.rb', line 10

def coerce(attributes)
  unless attributes.nil?
    super or @primitive.new(attributes)
  end
end