class MarkupFuel::Library::Serialize::Xml

This job works on a single register, reads its value, and serializes it using the XmlSimple gem. There is some nice documentation that ships with the gem located here: github.com/maik/xml-simple/tree/master/docs. More or less, this is just a Burner::Job wrapper around the XmlSimple#xml_out API.

Expected Payload input: Ruby object modeling. Payload output: XML representation of the Ruby object modeling as a string.

Constants

NO_ATTR_KEY
ROOT_NAME_KEY

Attributes

options[R]

Public Class Methods

new( name: '', no_attributes: true, register: Burner::DEFAULT_REGISTER, root_name: nil ) click to toggle source
Calls superclass method
# File lib/markup_fuel/library/serialize/xml.rb, line 26
def initialize(
  name: '',
  no_attributes: true,
  register: Burner::DEFAULT_REGISTER,
  root_name: nil
)
  super(name: name, register: register)

  @options = make_options(no_attributes, root_name)

  freeze
end

Public Instance Methods

make_options(no_attributes, root_name) click to toggle source
# File lib/markup_fuel/library/serialize/xml.rb, line 43
def make_options(no_attributes, root_name)
  { NO_ATTR_KEY => no_attributes }.tap do |opts|
    opts[ROOT_NAME_KEY] = root_name unless root_name.to_s.empty?
  end
end
perform(_output, payload) click to toggle source
# File lib/markup_fuel/library/serialize/xml.rb, line 39
def perform(_output, payload)
  payload[register] = XmlSimple.xml_out(payload[register] || {}, options)
end