Class: XML::Smart::ProcessingInstruction

Inherits:
Object
  • Object
show all
Defined in:
lib/xml/smart_processinginstruction.rb

Instance Method Summary collapse

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

#contentObject



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

#dumpObject



11
# File 'lib/xml/smart_processinginstruction.rb', line 11

def dump; @node.to_s; end

#parentObject



26
27
28
# File 'lib/xml/smart_processinginstruction.rb', line 26

def parent
  Dom::smart_helper(@node.parent)
end

#parent?Boolean

Returns:

  • (Boolean)


29
# File 'lib/xml/smart_processinginstruction.rb', line 29

def parent?; !@node.parent.nil?; end

#pathObject



31
# File 'lib/xml/smart_processinginstruction.rb', line 31

def path; @node.path; end

#qnameObject



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_idObject



38
# File 'lib/xml/smart_processinginstruction.rb', line 38

def unique_id; @node.pointer_id; end