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.



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

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



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

def node
  @node
end

Instance Method Details

#==(other) ⇒ Object



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

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:



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

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



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

def set_text text
  @node = text
  self
end