Sha256: dc88d0e25812eb76f49012d347c3e15cce17f16a69b4959a6dc254596ae964dd

Contents?: true

Size: 1.29 KB

Versions: 13

Compression:

Stored size: 1.29 KB

Contents

module RR
  class DoubleMatches
    attr_reader :matching_doubles,
                :exact_terminal_doubles_to_attempt,
                :exact_non_terminal_doubles_to_attempt,
                :wildcard_terminal_doubles_to_attempt,
                :wildcard_non_terminal_doubles_to_attempt

    def initialize(doubles) #:nodoc:
      @doubles = doubles
      @matching_doubles = []
      @exact_terminal_doubles_to_attempt = []
      @exact_non_terminal_doubles_to_attempt = []
      @wildcard_terminal_doubles_to_attempt = []
      @wildcard_non_terminal_doubles_to_attempt = []
    end

    def find_all_matches(args)
      @doubles.each do |double|
        if double.exact_match?(*args)
          matching_doubles << double
          if double.attempt?
            if double.terminal?
              exact_terminal_doubles_to_attempt << double
            else
              exact_non_terminal_doubles_to_attempt << double
            end
          end
        elsif double.wildcard_match?(*args)
          matching_doubles << double
          if double.attempt?
            if double.terminal?
              wildcard_terminal_doubles_to_attempt << double
            else
              wildcard_non_terminal_doubles_to_attempt << double
            end
          end
        end
      end
      self
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rr-1.2.1 lib/rr/double_matches.rb
rr-1.2.0 lib/rr/double_matches.rb
rr-1.1.2 lib/rr/double_matches.rb
rr-1.1.2.rc1 lib/rr/double_matches.rb
rr-1.1.1 lib/rr/double_matches.rb
rr-1.1.1.rc1 lib/rr/double_matches.rb
rr-1.1.0 lib/rr/double_matches.rb
rr-1.1.0.rc3 lib/rr/double_matches.rb
rr-1.1.0.rc2 lib/rr/double_matches.rb
rr-1.1.0.rc1 lib/rr/double_matches.rb
rr-1.0.5 lib/rr/double_matches.rb
rr-1.0.5.rc2 lib/rr/double_matches.rb
rr-1.0.5.rc1 lib/rr/double_matches.rb