Sha256: c3a3cfe233f39d5997e5196df387a248b75843aa673867e75835bd328bff4ab2

Contents?: true

Size: 1.2 KB

Versions: 55

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

module RuboCop
  module AST
    # A node extension for `kwsplat` nodes. This will be used in place of a
    # plain  node when the builder constructs the AST, making its methods
    # available to all `kwsplat` nodes within RuboCop.
    class KeywordSplatNode < Node
      include HashElementNode

      DOUBLE_SPLAT = '**'
      private_constant :DOUBLE_SPLAT

      # This is used for duck typing with `pair` nodes which also appear as
      # `hash` elements.
      #
      # @return [false]
      def hash_rocket?
        false
      end

      # This is used for duck typing with `pair` nodes which also appear as
      # `hash` elements.
      #
      # @return [false]
      def colon?
        false
      end

      # Returns the operator for the `kwsplat` as a string.
      #
      # @return [String] the double splat operator
      def operator
        DOUBLE_SPLAT
      end

      # Custom destructuring method. This is used to normalize the branches
      # for `pair` and `kwsplat` nodes, to add duck typing to `hash` elements.
      #
      # @return [Array<KeywordSplatNode>] the different parts of the `kwsplat`
      def node_parts
        [self, self]
      end
    end
  end
end

Version data entries

55 entries across 51 versions & 8 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rubocop-ast-1.23.0/lib/rubocop/ast/node/keyword_splat_node.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rubocop-ast-1.23.0/lib/rubocop/ast/node/keyword_splat_node.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rubocop-ast-1.23.0/lib/rubocop/ast/node/keyword_splat_node.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-ast-1.19.1/lib/rubocop/ast/node/keyword_splat_node.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-ast-1.16.0/lib/rubocop/ast/node/keyword_splat_node.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-ast-1.21.0/lib/rubocop/ast/node/keyword_splat_node.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-ast-1.21.0/lib/rubocop/ast/node/keyword_splat_node.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-ast-1.16.0/lib/rubocop/ast/node/keyword_splat_node.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-ast-1.19.1/lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-1.27.0 lib/rubocop/ast/node/keyword_splat_node.rb
zilla-0.2.0 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.26.0/lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-1.26.0 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-1.25.0 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-1.24.1 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-1.24.0 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-1.23.0 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-1.22.0 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-1.21.0 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-1.20.1 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-1.20.0 lib/rubocop/ast/node/keyword_splat_node.rb