Class: RDoc::RubyToken::TkOp

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

Direct Known Subclasses

TkOPASGN

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 = nil) ⇒ TkOp

Returns a new instance of TkOp.



159
160
161
162
# File 'lib/rdoc/ruby_token.rb', line 159

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

Instance Attribute Details

#nameObject Also known as: text

Returns the value of attribute name.



164
165
166
# File 'lib/rdoc/ruby_token.rb', line 164

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



166
167
168
169
170
171
# File 'lib/rdoc/ruby_token.rb', line 166

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:



180
181
182
183
# File 'lib/rdoc/ruby_token.rb', line 180

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



173
174
175
176
# File 'lib/rdoc/ruby_token.rb', line 173

def set_text text
  @name = text
  self
end