Sha256: f10f257679d88c163d651b740347cc29749b3e5e5c7cacf3e9f260ff8f91b867

Contents?: true

Size: 1.17 KB

Versions: 68

Compression:

Stored size: 1.17 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 = '**'

      # 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

68 entries across 48 versions & 6 rubygems

Version Path
plaid-14.13.0 vendor/bundle/ruby/3.0.0/gems/rubocop-ast-0.4.2/lib/rubocop/ast/node/keyword_splat_node.rb
plaid-14.12.1 vendor/bundle/ruby/3.0.0/gems/rubocop-ast-0.4.2/lib/rubocop/ast/node/keyword_splat_node.rb
plaid-14.12.0 vendor/bundle/ruby/2.6.0/gems/rubocop-ast-0.4.2/lib/rubocop/ast/node/keyword_splat_node.rb
plaid-14.11.1 vendor/bundle/ruby/2.6.0/gems/rubocop-ast-0.4.2/lib/rubocop/ast/node/keyword_splat_node.rb
plaid-14.10.0 vendor/bundle/ruby/2.6.0/gems/rubocop-ast-0.4.2/lib/rubocop/ast/node/keyword_splat_node.rb
plaid-14.7.0 vendor/bundle/ruby/2.6.0/gems/rubocop-ast-0.4.2/lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-0.6.0 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-0.5.1 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-0.5.0 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-0.4.2 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-0.4.1 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-0.4.0 lib/rubocop/ast/node/keyword_splat_node.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.79.0/lib/rubocop/ast/node/keyword_splat_node.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-0.3.0 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-0.2.0 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-0.1.0 lib/rubocop/ast/node/keyword_splat_node.rb
files.com-1.0.1 vendor/bundle/ruby/2.5.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-0.0.3 lib/rubocop/ast/node/keyword_splat_node.rb
rubocop-ast-0.0.2 lib/rubocop/ast/node/keyword_splat_node.rb