class Shale::Adapter::Ox::Document

Wrapper around Ox API

@api private

Attributes

doc[R]

Return Ox document

@return [::Ox::Document]

@api private

Public Class Methods

new() click to toggle source

Initialize object

@api private

# File lib/shale/adapter/ox.rb, line 54
def initialize
  @doc = ::Ox::Document.new
end

Public Instance Methods

add_attribute(element, name, value) click to toggle source

Add attribute to Ox element

@param [::Ox::Element] element Ox element @param [String] name Name of the XML attribute @param [String] value Value of the XML attribute

@api private

# File lib/shale/adapter/ox.rb, line 76
def add_attribute(element, name, value)
  element[name] = value
end
add_element(element, child) click to toggle source

Add child element to Ox element

@param [::Ox::Element] element Ox parent element @param [::Ox::Element] child Ox child element

@api private

# File lib/shale/adapter/ox.rb, line 86
def add_element(element, child)
  element << child
end
add_text(element, text) click to toggle source

Add text node to Ox element

@param [::Ox::Element] element Ox element @param [String] text Text to add

@api private

# File lib/shale/adapter/ox.rb, line 96
def add_text(element, text)
  element << text
end
create_element(name) click to toggle source

Create Ox element

@param [String] name Name of the XML element

@return [::Ox::Element]

@api private

# File lib/shale/adapter/ox.rb, line 65
def create_element(name)
  ::Ox::Element.new(name)
end