Class: Fdlint::Parser::Node

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Node.



8
9
10
11
12
13
14
# File 'lib/fdlint/parser/node.rb', line 8

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.



6
7
8
# File 'lib/fdlint/parser/node.rb', line 6

def position
  @position
end

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/fdlint/parser/node.rb', line 6

def text
  @text
end

Instance Method Details

#=~(other) ⇒ Object



16
17
18
# File 'lib/fdlint/parser/node.rb', line 16

def =~(other)
  text =~ other
end

#to_sObject



20
21
22
# File 'lib/fdlint/parser/node.rb', line 20

def to_s
  text
end