Sha256: f76317a227a3cb60da23026b5d5c9e0ccb76249bad97602b5a26c46ea3fba0a3

Contents?: true

Size: 531 Bytes

Versions: 6

Compression:

Stored size: 531 Bytes

Contents

# frozen_string_literal: true

module Leftovers
  module Matchers
    class NodeHasAnyPositionalArgumentWithValue
      # :nocov:
      using ::Leftovers::Backports::SetCaseEq if defined?(::Leftovers::Backports::SetCaseEq)
      # :nocov:

      def initialize(matcher)
        @matcher = matcher

        freeze
      end

      def ===(node)
        args = node.positional_arguments
        return false unless args

        args.any? do |value|
          @matcher === value
        end
      end

      freeze
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
leftovers-0.5.5 lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb
leftovers-0.5.4 lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb
leftovers-0.5.3 lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb
leftovers-0.5.2 lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb
leftovers-0.5.1 lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb
leftovers-0.5.0 lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb