Class: RDoc::RubyToken::TkId

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

Direct Known Subclasses

TkKW

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, name) ⇒ TkId

Returns a new instance of TkId.



101
102
103
104
# File 'lib/rdoc/ruby_token.rb', line 101

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

Instance Attribute Details

#nameObject (readonly) Also known as: text

Returns the value of attribute name



105
106
107
# File 'lib/rdoc/ruby_token.rb', line 105

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



107
108
109
110
111
112
# File 'lib/rdoc/ruby_token.rb', line 107

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

#inspectObject

:nodoc:



121
122
123
124
# File 'lib/rdoc/ruby_token.rb', line 121

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

#set_text(text) ⇒ Object



114
115
116
117
# File 'lib/rdoc/ruby_token.rb', line 114

def set_text text
  @name = text
  self
end