class RuboCop::Token

A basic wrapper around Parser's tokens.

Attributes

pos[R]
text[R]
type[R]

Public Class Methods

from_parser_token(parser_token) click to toggle source
# File lib/rubocop/token.rb, line 7
def self.from_parser_token(parser_token)
  type, details = parser_token
  text, range = details
  new(range, type, text)
end
new(pos, type, text) click to toggle source
# File lib/rubocop/token.rb, line 13
def initialize(pos, type, text)
  @pos = pos
  @type = type
  # Parser token "text" may be an Integer
  @text = text.to_s
end

Public Instance Methods

to_s() click to toggle source
# File lib/rubocop/token.rb, line 20
def to_s
  "[[#{@pos.line}, #{@pos.column}], #{@type}, #{@text.inspect}]"
end