Class: TTY::Config::Marshallers::XMLMarshaller

Inherits:
Object
  • Object
show all
Includes:
TTY::Config::Marshaller
Defined in:
lib/tty/config/marshallers/xml_marshaller.rb

Overview

Responsible for marshalling content from and into XML format

Instance Method Summary collapse

Methods included from TTY::Config::Marshaller

included

Instance Method Details

#marshal(object) ⇒ Object


18
19
20
# File 'lib/tty/config/marshallers/xml_marshaller.rb', line 18

def marshal(object)
  XmlSimple.xml_out(object, {rootname: "config"})
end

#unmarshal(content) ⇒ Object


22
23
24
25
26
# File 'lib/tty/config/marshallers/xml_marshaller.rb', line 22

def unmarshal(content)
  return {} if content.empty?

  XmlSimple.xml_in(content, {force_array: false})
end