class Sendregning::XmlSerializer

Attributes

builder[R]
item[R]

Public Class Methods

build(item, options = {}) click to toggle source
# File lib/sendregning/xml_serializer.rb, line 6
def build(item, options = {})
  builder = options[:builder] || xml_builder
  new(item, builder).build
end
new(item, builder) click to toggle source
# File lib/sendregning/xml_serializer.rb, line 20
def initialize(item, builder)
  @item = item
  @builder = builder
end

Protected Class Methods

xml_builder() click to toggle source
# File lib/sendregning/xml_serializer.rb, line 13
def xml_builder
  xml = Builder::XmlMarkup.new(indent: 2)
  xml.instruct! :xml, version: "1.0", encoding: "UTF-8"
  xml
end

Public Instance Methods

build() click to toggle source
# File lib/sendregning/xml_serializer.rb, line 25
def build
  raise("XmlSerializer is an abstract class, subclass and overwrite " \
        "the build method")
end