Class: XRay::Node

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text = '', position = nil) ⇒ Node

Returns a new instance of Node.



9
10
11
12
13
14
15
16
# File 'lib/node.rb', line 9

def initialize(text = '', position = nil)

  if text.is_a? Node
    @text, @position = text.text, text.position
  else
    @text, @position = (text || '').strip, position
  end
end

Instance Attribute Details

#positionObject

Returns the value of attribute position.



7
8
9
# File 'lib/node.rb', line 7

def position
  @position
end

#textObject

Returns the value of attribute text.



7
8
9
# File 'lib/node.rb', line 7

def text
  @text
end

Instance Method Details

#=~(other) ⇒ Object



18
19
20
# File 'lib/node.rb', line 18

def =~(other)
  text =~ other
end

#to_sObject



22
23
24
# File 'lib/node.rb', line 22

def to_s
  text
end