Class: ActiveRecord::XmlSerializer::ValueAttribute

Inherits:
Attribute
  • Object
show all
Defined in:
lib/xml_serializer_dumper_support.rb

Overview

An attribute where the type and value are based on the values when created

Instance Method Summary collapse

Constructor Details

#initialize(name, record, value) ⇒ ValueAttribute

Returns a new instance of ValueAttribute.



34
35
36
37
# File 'lib/xml_serializer_dumper_support.rb', line 34

def initialize(name, record, value)
  @value = value
  super(name, record)
end

Instance Method Details

#compute_typeObject

:nodoc:



43
44
45
# File 'lib/xml_serializer_dumper_support.rb', line 43

def compute_type#:nodoc:
  Hash::XML_TYPE_NAMES[@value.class.name] || :string
end

#compute_valueObject

:nodoc:



39
40
41
# File 'lib/xml_serializer_dumper_support.rb', line 39

def compute_value#:nodoc:
  @value
end