Class: Virtus::Attribute::EmbeddedValue::FromOpenStruct
- Defined in:
- lib/virtus/attribute/embedded_value.rb
Overview
Builds OpenStruct-like instance with attributes passed to the constructor as a hash
Instance Attribute Summary
Attributes inherited from Coercer
Instance Method Summary collapse
Methods inherited from Coercer
Constructor Details
This class inherits a constructor from Virtus::Coercer
Instance Method Details
#call(input) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/virtus/attribute/embedded_value.rb', line 33 def call(input) if input.kind_of?(primitive) input elsif not input.nil? primitive.new(input) end end |