Class: RDocRuboCop::Lang::Ruby::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc_rubocop/lang/ruby/token.rb,
lib/rdoc_rubocop/lang/ruby/token/comment_token.rb

Direct Known Subclasses

CommentToken

Defined Under Namespace

Classes: CommentToken

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(locate, type, token, state) ⇒ Token

Returns a new instance of Token.



16
17
18
19
20
21
# File 'lib/rdoc_rubocop/lang/ruby/token.rb', line 16

def initialize(locate, type, token, state)
  @locate = locate
  @type   = type
  @token  = token
  @state  = state
end

Instance Attribute Details

#locateObject (readonly)

Returns the value of attribute locate.



5
6
7
# File 'lib/rdoc_rubocop/lang/ruby/token.rb', line 5

def locate
  @locate
end

#stateObject (readonly)

Returns the value of attribute state.



5
6
7
# File 'lib/rdoc_rubocop/lang/ruby/token.rb', line 5

def state
  @state
end

#tokenObject (readonly)

Returns the value of attribute token.



5
6
7
# File 'lib/rdoc_rubocop/lang/ruby/token.rb', line 5

def token
  @token
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/rdoc_rubocop/lang/ruby/token.rb', line 5

def type
  @type
end

Class Method Details

.build(locate, type, token, state) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/rdoc_rubocop/lang/ruby/token.rb', line 7

def self.build(locate, type, token, state)
  case type
  when :on_comment
    CommentToken.new(locate, type, token, state)
  else
    new(locate, type, token, state)
  end
end

Instance Method Details

#columnObject



27
28
29
# File 'lib/rdoc_rubocop/lang/ruby/token.rb', line 27

def column
  @locate[1]
end

#linenoObject



23
24
25
# File 'lib/rdoc_rubocop/lang/ruby/token.rb', line 23

def lineno
  @locate[0]
end