Class: Shale::Adapter::Ox::Document Private

Inherits:
Object
  • Object
show all
Defined in:
lib/shale/adapter/ox/document.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Wrapper around Ox API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDocument

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize object



20
21
22
# File 'lib/shale/adapter/ox/document.rb', line 20

def initialize
  @doc = ::Ox::Document.new
end

Instance Attribute Details

#doc::Ox::Document (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return Ox document

Returns:

  • (::Ox::Document)


15
16
17
# File 'lib/shale/adapter/ox/document.rb', line 15

def doc
  @doc
end

Instance Method Details

#add_attribute(element, name, value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add attribute to Ox element

Parameters:

  • element (::Ox::Element)

    Ox element

  • name (String)

    Name of the XML attribute

  • value (String)

    Value of the XML attribute



64
65
66
# File 'lib/shale/adapter/ox/document.rb', line 64

def add_attribute(element, name, value)
  element[name] = value
end

#add_element(element, child) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add child element to Ox element

Parameters:

  • element (::Ox::Element)

    Ox parent element

  • child (::Ox::Element)

    Ox child element



74
75
76
# File 'lib/shale/adapter/ox/document.rb', line 74

def add_element(element, child)
  element << child
end

#add_namespace(prefix, namespace) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add XML namespace to document

Ox doesn’t support XML namespaces so this method does nothing.

Parameters:

  • prefix (String)
  • namespace (String)


53
54
55
# File 'lib/shale/adapter/ox/document.rb', line 53

def add_namespace(prefix, namespace)
  # :noop:
end

#add_text(element, text) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add text node to Ox element

Parameters:

  • element (::Ox::Element)

    Ox element

  • text (String)

    Text to add



84
85
86
# File 'lib/shale/adapter/ox/document.rb', line 84

def add_text(element, text)
  element << text
end

#create_cdata(text, parent) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create CDATA node and add it to parent

Parameters:

  • text (String)
  • parent (::Ox::Element)


41
42
43
# File 'lib/shale/adapter/ox/document.rb', line 41

def create_cdata(text, parent)
  parent << ::Ox::CData.new(text)
end

#create_element(name) ⇒ ::Ox::Element

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create Ox element

Parameters:

  • name (String)

    Name of the XML element

Returns:

  • (::Ox::Element)


31
32
33
# File 'lib/shale/adapter/ox/document.rb', line 31

def create_element(name)
  ::Ox::Element.new(name)
end