Sha256: 363d7eeb44a2e4fc73801a2fcef69e9b9b9d9a4beeb0db17203e69f474e40cb2

Contents?: true

Size: 478 Bytes

Versions: 3

Compression:

Stored size: 478 Bytes

Contents

module Fakes
  class CombinedArgMatcher
    attr_reader :all_matchers

    def initialize(options = {})
      @all_matchers = options.fetch(:matchers,[])
    end

    def matches?(args)
      matches = true
      @all_matchers.each_with_index do |matcher, index|
        value = args[index]
        matches &= matcher.matches?(value)
        return false unless matches
      end
      matches
    end

    def add(matcher)
      @all_matchers << matcher
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fakes-1.1.2 lib/fakes/arg_matching/combined_arg_matcher.rb
fakes-1.1.1 lib/fakes/arg_matching/combined_arg_matcher.rb
fakes-1.1.0 lib/fakes/arg_matching/combined_arg_matcher.rb