Class: Shale::Adapter::Ox::Document Private
- Inherits:
-
Object
- Object
- Shale::Adapter::Ox::Document
- 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
-
#doc ⇒ ::Ox::Document
readonly
private
Return Ox document.
Instance Method Summary collapse
-
#add_attribute(element, name, value) ⇒ Object
private
Add attribute to Ox element.
-
#add_element(element, child) ⇒ Object
private
Add child element to Ox element.
-
#add_namespace(prefix, namespace) ⇒ Object
private
Add XML namespace to document.
-
#add_text(element, text) ⇒ Object
private
Add text node to Ox element.
-
#create_cdata(text, parent) ⇒ Object
private
Create CDATA node and add it to parent.
-
#create_element(name) ⇒ ::Ox::Element
private
Create Ox element.
-
#initialize ⇒ Document
constructor
private
Initialize object.
Constructor Details
#initialize ⇒ Document
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
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
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
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.
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
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
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
31 32 33 |
# File 'lib/shale/adapter/ox/document.rb', line 31 def create_element(name) ::Ox::Element.new(name) end |