Sha256: f631932019a78419976c4f8270239e30fb159f48a05c70338e58b4223ed1ce42
Contents?: true
Size: 1.48 KB
Versions: 19
Compression:
Stored size: 1.48 KB
Contents
module RR class ScenarioMatches attr_reader :matching_scenarios, :exact_terminal_scenarios_to_attempt, :exact_non_terminal_scenarios_to_attempt, :wildcard_terminal_scenarios_to_attempt, :wildcard_non_terminal_scenarios_to_attempt def initialize(scenarios) @scenarios = scenarios @matching_scenarios = [] @exact_terminal_scenarios_to_attempt = [] @exact_non_terminal_scenarios_to_attempt = [] @wildcard_terminal_scenarios_to_attempt = [] @wildcard_non_terminal_scenarios_to_attempt = [] end def find_all_matches!(args) @scenarios.each do |scenario| if scenario.exact_match?(*args) matching_scenarios << scenario if scenario.attempt? exact_scenario_is_terminal_or_non_terminal scenario end elsif scenario.wildcard_match?(*args) matching_scenarios << scenario if scenario.attempt? wildcard_scenario_is_terminal_or_non_terminal scenario end end end self end protected def exact_scenario_is_terminal_or_non_terminal(scenario) if scenario.terminal? exact_terminal_scenarios_to_attempt << scenario else exact_non_terminal_scenarios_to_attempt << scenario end end def wildcard_scenario_is_terminal_or_non_terminal(scenario) if scenario.terminal? wildcard_terminal_scenarios_to_attempt << scenario else wildcard_non_terminal_scenarios_to_attempt << scenario end end end end
Version data entries
19 entries across 19 versions & 1 rubygems