Class: XML::Smart::ProcessingInstruction
- Inherits:
-
Object
- Object
- XML::Smart::ProcessingInstruction
- Defined in:
- lib/xml/smart_processinginstruction.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #===(cls) ⇒ Object
- #content ⇒ Object
- #content=(t) ⇒ Object
- #dump ⇒ Object
-
#initialize(element) ⇒ ProcessingInstruction
constructor
A new instance of ProcessingInstruction.
- #parent ⇒ Object
- #parent? ⇒ Boolean
- #path ⇒ Object
- #qname ⇒ Object
- #replace_by(n) ⇒ Object
- #unique_id ⇒ Object
Constructor Details
#initialize(element) ⇒ ProcessingInstruction
Returns a new instance of ProcessingInstruction.
5 6 7 |
# File 'lib/xml/smart_processinginstruction.rb', line 5 def initialize(element) @node = element end |
Instance Method Details
#==(other) ⇒ Object
33 34 35 36 37 |
# File 'lib/xml/smart_processinginstruction.rb', line 33 def ==(other) return false unless other return false unless other.respond_to?(:unique_id) unique_id == other.unique_id end |
#===(cls) ⇒ Object
9 |
# File 'lib/xml/smart_processinginstruction.rb', line 9 def ===(cls); self.is_a? cls; end |
#content ⇒ Object
23 |
# File 'lib/xml/smart_processinginstruction.rb', line 23 def content; @node.content end |
#content=(t) ⇒ Object
24 |
# File 'lib/xml/smart_processinginstruction.rb', line 24 def content=(t); @node.content = t.to_s if t.respond_to? :to_s; end |
#dump ⇒ Object
11 |
# File 'lib/xml/smart_processinginstruction.rb', line 11 def dump; @node.to_s; end |
#parent ⇒ Object
26 27 28 |
# File 'lib/xml/smart_processinginstruction.rb', line 26 def parent Dom::smart_helper(@node.parent) end |
#parent? ⇒ Boolean
29 |
# File 'lib/xml/smart_processinginstruction.rb', line 29 def parent?; !@node.parent.nil?; end |
#path ⇒ Object
31 |
# File 'lib/xml/smart_processinginstruction.rb', line 31 def path; @node.path; end |
#qname ⇒ Object
21 |
# File 'lib/xml/smart_processinginstruction.rb', line 21 def qname; QName.new @node; end |
#replace_by(n) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/xml/smart_processinginstruction.rb', line 13 def replace_by(n) case n when ProcessingInstruction; ProcessingInstruction.new @node.replace(n.instance_variable_get(:@node)) else nil end end |
#unique_id ⇒ Object
38 |
# File 'lib/xml/smart_processinginstruction.rb', line 38 def unique_id; @node.pointer_id; end |