Class: Coronet::MessageFormat::XmlMessageFormat

Inherits:
Base
  • Object
show all
Defined in:
lib/coronet/message_format/xml_message_format.rb

Instance Method Summary collapse

Methods inherited from Base

#transform

Instance Method Details

#pack(hash) ⇒ Object

transform hash to xml string



10
11
12
# File 'lib/coronet/message_format/xml_message_format.rb', line 10

def pack(hash)
  XmlSimple.xml_out(hash, noattr: true, rootname: nil).strip!
end

#unpack(xml_str) ⇒ Object

transform xml string to hash



5
6
7
# File 'lib/coronet/message_format/xml_message_format.rb', line 5

def unpack(xml_str)
  XmlSimple.xml_in(xml_str, forcearray: false, keeproot: true)
end