class RuboCop::AST::IndexasgnNode

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

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

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/indexasgn_node.rb, line 31
def assignment_method?
  true
end
attribute_accessor?() click to toggle source

For similarity with legacy mode

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

For similarity with legacy mode

# File lib/rubocop/ast/node/indexasgn_node.rb, line 36
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/indexasgn_node.rb, line 45
def first_argument_index
  1
end