Sha256: 1c716786fb62fb09d8bdebfce5688ae86279055e94c63481c7be7e8a84f67352

Contents?: true

Size: 702 Bytes

Versions: 16

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

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

      # It returns true if arguments are empty, and delimiters do not exist.
      # @example:
      #   # true
      #   def x; end
      #   x { }
      #   -> {}
      #
      #   # false
      #   def x(); end
      #   def x a; end
      #   x { || }
      #   -> () {}
      #   -> a {}
      def empty_and_without_delimiters?
        loc.expression.nil?
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
rubocop-0.59.2 lib/rubocop/ast/node/args_node.rb
rubocop-0.59.1 lib/rubocop/ast/node/args_node.rb
rubocop-0.59.0 lib/rubocop/ast/node/args_node.rb
rubocop-0.58.2 lib/rubocop/ast/node/args_node.rb
rubocop-0.58.1 lib/rubocop/ast/node/args_node.rb
rubocop-0.58.0 lib/rubocop/ast/node/args_node.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/rubocop-0.57.2/lib/rubocop/ast/node/args_node.rb
rubocop-0.57.2 lib/rubocop/ast/node/args_node.rb
rubocop-0.57.1 lib/rubocop/ast/node/args_node.rb
rubocop-0.57.0 lib/rubocop/ast/node/args_node.rb
rubocop-0.56.0 lib/rubocop/ast/node/args_node.rb
rubocop-0.55.0 lib/rubocop/ast/node/args_node.rb
rubocop-0.54.0 lib/rubocop/ast/node/args_node.rb
rubocop-0.53.0 lib/rubocop/ast/node/args_node.rb
rubocop-0.52.1 lib/rubocop/ast/node/args_node.rb
rubocop-0.52.0 lib/rubocop/ast/node/args_node.rb