class RuboCop::AST::IndexNode

Used for modern support only! Not as thoroughly tested as legacy equivalent

$ ruby-parse -e "foo[:bar]"
(index
  (send nil :foo)
  (sym :bar))
$ ruby-parse --legacy -e "foo[:bar]"
(send
  (send nil :foo) :[]
  (sym :bar))

The main RuboCop runs in legacy mode; this node is only used if user `AST::Builder.modernize` or `AST::Builder.emit_index=true`

Public Instance Methods

assignment_method?() click to toggle source

For similarity with legacy mode

# File lib/rubocop/ast/node/index_node.rb, line 29
def assignment_method?
  false
end
attribute_accessor?() click to toggle source

For similarity with legacy mode

# File lib/rubocop/ast/node/index_node.rb, line 24
def attribute_accessor?
  false
end
method_name() click to toggle source

For similarity with legacy mode

# File lib/rubocop/ast/node/index_node.rb, line 34
def method_name
  :[]
end

Private Instance Methods

first_argument_index() click to toggle source

An array containing the arguments of the dispatched method.

@return [Array<Node>] the arguments of the dispatched method

# File lib/rubocop/ast/node/index_node.rb, line 43
def first_argument_index
  1
end