Class: RR::DoubleMatches
- Inherits:
-
Object
- Object
- RR::DoubleMatches
- Defined in:
- lib/rr/double_matches.rb
Instance Attribute Summary collapse
-
#exact_non_terminal_doubles_to_attempt ⇒ Object
readonly
Returns the value of attribute exact_non_terminal_doubles_to_attempt.
-
#exact_terminal_doubles_to_attempt ⇒ Object
readonly
Returns the value of attribute exact_terminal_doubles_to_attempt.
-
#matching_doubles ⇒ Object
readonly
Returns the value of attribute matching_doubles.
-
#wildcard_non_terminal_doubles_to_attempt ⇒ Object
readonly
Returns the value of attribute wildcard_non_terminal_doubles_to_attempt.
-
#wildcard_terminal_doubles_to_attempt ⇒ Object
readonly
Returns the value of attribute wildcard_terminal_doubles_to_attempt.
Instance Method Summary collapse
- #find_all_matches(args, kwargs) ⇒ Object
-
#initialize(doubles) ⇒ DoubleMatches
constructor
:nodoc:.
Constructor Details
#initialize(doubles) ⇒ DoubleMatches
:nodoc:
9 10 11 12 13 14 15 16 |
# File 'lib/rr/double_matches.rb', line 9 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 |
Instance Attribute Details
#exact_non_terminal_doubles_to_attempt ⇒ Object (readonly)
Returns the value of attribute exact_non_terminal_doubles_to_attempt.
3 4 5 |
# File 'lib/rr/double_matches.rb', line 3 def exact_non_terminal_doubles_to_attempt @exact_non_terminal_doubles_to_attempt end |
#exact_terminal_doubles_to_attempt ⇒ Object (readonly)
Returns the value of attribute exact_terminal_doubles_to_attempt.
3 4 5 |
# File 'lib/rr/double_matches.rb', line 3 def exact_terminal_doubles_to_attempt @exact_terminal_doubles_to_attempt end |
#matching_doubles ⇒ Object (readonly)
Returns the value of attribute matching_doubles.
3 4 5 |
# File 'lib/rr/double_matches.rb', line 3 def matching_doubles @matching_doubles end |
#wildcard_non_terminal_doubles_to_attempt ⇒ Object (readonly)
Returns the value of attribute wildcard_non_terminal_doubles_to_attempt.
3 4 5 |
# File 'lib/rr/double_matches.rb', line 3 def wildcard_non_terminal_doubles_to_attempt @wildcard_non_terminal_doubles_to_attempt end |
#wildcard_terminal_doubles_to_attempt ⇒ Object (readonly)
Returns the value of attribute wildcard_terminal_doubles_to_attempt.
3 4 5 |
# File 'lib/rr/double_matches.rb', line 3 def wildcard_terminal_doubles_to_attempt @wildcard_terminal_doubles_to_attempt end |
Instance Method Details
#find_all_matches(args, kwargs) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rr/double_matches.rb', line 18 def find_all_matches(args, kwargs) kwargs ||= {} @doubles.each do |double| if double.exact_match?(args, kwargs) 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, kwargs) 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 |