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 (and answer mutations: creation routes native via add_pi; removal has no engine entry).
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.
19 20 21 22 23 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 19 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.
15 16 17 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 15 def data @data end |
#parent_doc ⇒ Object
Returns the value of attribute parent_doc.
15 16 17 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 15 def parent_doc @parent_doc end |
#target ⇒ Object
Returns the value of attribute target.
15 16 17 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 15 def target @target end |
Instance Method Details
#==(other) ⇒ Object
29 30 31 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 29 def ==(other) other.is_a?(self.class) && target == other.target && data == other.data end |
#to_xml ⇒ Object
25 26 27 |
# File 'lib/moxml/adapter/customized_leptris/document_pi.rb', line 25 def to_xml data.empty? ? "<?#{target}?>" : "<?#{target} #{data}?>" end |