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)
  @element = 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; @element.content end

#content=(t) ⇒ Object



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

def content=(t); @element.content = t.to_s if t.respond_to? :to_s; end

#dumpObject



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

def dump; @element.to_s; end

#parentObject



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

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

#parent?Boolean

Returns:

  • (Boolean)


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

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

#pathObject



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

def path; @element.path; end

#qnameObject



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

def qname; QName.new @element; 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 @element.replace(n.instance_variable_get(:@element))
    else
      nil
  end
end

#unique_idObject



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

def unique_id; @element.pointer_id; end