class Virtus::Attribute::EmbeddedValue
EmbeddedValue handles virtus-like objects, OpenStruct and Struct
Constants
- TYPES
Public Class Methods
build_coercer(type, _options)
click to toggle source
@api private
# File lib/virtus/attribute/embedded_value.rb, line 54 def self.build_coercer(type, _options) primitive = type.primitive if primitive < Virtus || primitive < Model::Constructor || primitive <= OpenStruct FromOpenStruct.new(type) elsif primitive < Struct FromStruct.new(type) end end
build_type(definition)
click to toggle source
@api private
# File lib/virtus/attribute/embedded_value.rb, line 49 def self.build_type(definition) Axiom::Types::Object.new { primitive definition.primitive } end
handles?(klass)
click to toggle source
@api private
# File lib/virtus/attribute/embedded_value.rb, line 44 def self.handles?(klass) klass.is_a?(Class) && TYPES.any? { |type| klass <= type } end