Class: RDoc::RubyToken::TkNode

Inherits:
Token
  • Object
show all
Defined in:
lib/rdoc/ruby_token.rb

Instance Attribute Summary collapse

Attributes inherited from Token

#char_no, #line_no, #seek

Instance Method Summary collapse

Constructor Details

#initialize(seek, line_no, char_no, node = nil) ⇒ TkNode

Returns a new instance of TkNode


71
72
73
74
# File 'lib/rdoc/ruby_token.rb', line 71

def initialize(seek, line_no, char_no, node = nil)
  super seek, line_no, char_no
  @node = node
end

Instance Attribute Details

#nodeObject (readonly) Also known as: text

Returns the value of attribute node


76
77
78
# File 'lib/rdoc/ruby_token.rb', line 76

def node
  @node
end

Instance Method Details

#==(other) ⇒ Object


78
79
80
81
82
83
# File 'lib/rdoc/ruby_token.rb', line 78

def ==(other)
  self.class == other.class and
  other.line_no == @line_no and
  other.char_no == @char_no and
  other.node == @node
end

#inspectObject

:nodoc:


92
93
94
95
# File 'lib/rdoc/ruby_token.rb', line 92

def inspect # :nodoc:
  klass = self.class.name.split('::').last
  "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @node]
end

#set_text(text) ⇒ Object


85
86
87
88
# File 'lib/rdoc/ruby_token.rb', line 85

def set_text text
  @node = text
  self
end