Class: Moxml::Adapter::CustomizedLeptris::DocumentPI
- Inherits:
-
Object
- Object
- Moxml::Adapter::CustomizedLeptris::DocumentPI
- Defined in:
- lib/moxml/adapter/customized_leptris/document_pi.rb
Overview
Document-level processing instruction. libleptris stores these outside the element tree (a flat, document-ordered list with no prolog/epilog anchoring — its serializer emits them all before the root), reachable through Document#processing_instructions as [target, data] pairs. This pseudo-native gives the pairs a node identity so the moxml contract can list them as document children.
Instance Attribute Summary collapse
-
#data ⇒ Object
(also: #content)
Returns the value of attribute data.
-
#parent_doc ⇒ Object
Returns the value of attribute parent_doc.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(target, data = "", parent_doc = nil) ⇒ DocumentPI
constructor
A new instance of DocumentPI.
- #to_xml ⇒ Object
Constructor Details
#initialize(target, data = "", parent_doc = nil) ⇒ DocumentPI
Returns a new instance of DocumentPI.
18 19 20 21 22 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 18 def initialize(target, data = "", parent_doc = nil) @target = target @data = data.to_s @parent_doc = parent_doc end |
Instance Attribute Details
#data ⇒ Object Also known as: content
Returns the value of attribute data.
14 15 16 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 14 def data @data end |
#parent_doc ⇒ Object
Returns the value of attribute parent_doc.
14 15 16 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 14 def parent_doc @parent_doc end |
#target ⇒ Object
Returns the value of attribute target.
14 15 16 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 14 def target @target end |
Instance Method Details
#==(other) ⇒ Object
28 29 30 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 28 def ==(other) other.is_a?(self.class) && target == other.target && data == other.data end |
#to_xml ⇒ Object
24 25 26 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 24 def to_xml data.empty? ? "<?#{target}?>" : "<?#{target} #{data}?>" end |