Class: ONIX::Serializer::Default::Primitive

Inherits:
Object
  • Object
show all
Defined in:
lib/onix/serializer.rb

Class Method Summary collapse

Class Method Details

.serialize(xml, val, tag, level = 0) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/onix/serializer.rb', line 93

def self.serialize(xml, val, tag, level = 0)
  if val.is_a?(ONIX::TextWithAttributes)
    if val.serialized_attributes["textformat"] == "05" # content is XHTML
      xml.send(tag, val.serialized_attributes) do
        xml.__send__ :insert, val.to_s
      end
    else
      xml.send(tag, val.serialized_attributes, val)
    end
  else
    xml.send(tag, val)
  end
end