Class: Rubocop::Cop::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/cop/cop.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pos, type, text) ⇒ Token

Returns a new instance of Token.



24
25
26
# File 'lib/rubocop/cop/cop.rb', line 24

def initialize(pos, type, text)
  @pos, @type, @text = Position.new(*pos), type, text
end

Instance Attribute Details

#posObject (readonly)

Returns the value of attribute pos.



22
23
24
# File 'lib/rubocop/cop/cop.rb', line 22

def pos
  @pos
end

#textObject (readonly)

Returns the value of attribute text.



22
23
24
# File 'lib/rubocop/cop/cop.rb', line 22

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



22
23
24
# File 'lib/rubocop/cop/cop.rb', line 22

def type
  @type
end

Instance Method Details

#to_sObject



28
29
30
# File 'lib/rubocop/cop/cop.rb', line 28

def to_s
  "[[#{@pos.lineno}, #{@pos.column}], #@type, #{@text.inspect}]"
end