Sha256: 1b35cb3691a41c481713a9d1cf0c9cabcd8eee8b9ae14aff8005016057e7f6bf

Contents?: true

Size: 1.16 KB

Versions: 196

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

module RuboCop
  module AST
    # 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`
    class IndexasgnNode < Node
      include ParameterizedNode::RestArguments
      include MethodDispatchNode

      # For similarity with legacy mode
      def attribute_accessor?
        false
      end

      # For similarity with legacy mode
      def assignment_method?
        true
      end

      # For similarity with legacy mode
      def method_name
        :[]=
      end

      private

      # An array containing the arguments of the dispatched method.
      #
      # @return [Array<Node>] the arguments of the dispatched method
      def first_argument_index
        1
      end
    end
  end
end

Version data entries

196 entries across 190 versions & 24 rubygems

Version Path
harbr-0.1.43 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
harbr-0.1.42 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
harbr-0.1.41 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
harbr-0.1.39 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
harbr-0.1.38 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
harbr-0.1.37 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
getargv-0.3.3-universal-darwin vendor/bundle/ruby/3.3.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
study_line-0.1.6 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
study_line-0.1.5 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
study_line-0.1.4 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
study_line-0.1.3 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
study_line-0.1.2 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
study_line-0.1.1 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/node/indexasgn_node.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/node/indexasgn_node.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-ast-1.21.0/lib/rubocop/ast/node/indexasgn_node.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-ast-1.19.1/lib/rubocop/ast/node/indexasgn_node.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-ast-1.16.0/lib/rubocop/ast/node/indexasgn_node.rb
rubocop-ast-1.30.0 lib/rubocop/ast/node/indexasgn_node.rb
synctera_ruby_sdk-1.1.3 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/node/indexasgn_node.rb
synctera_ruby_sdk-1.1.2 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.29.0/lib/rubocop/ast/node/indexasgn_node.rb