Class: RR::TimesCalledMatchers::RangeMatcher

Inherits:
TimesCalledMatcher show all
Defined in:
lib/rr/times_called_matchers/range_matcher.rb

Instance Attribute Summary

Attributes inherited from TimesCalledMatcher

#times

Instance Method Summary collapse

Methods inherited from TimesCalledMatcher

#==, create, #error_message, #initialize

Constructor Details

This class inherits a constructor from RR::TimesCalledMatchers::TimesCalledMatcher

Instance Method Details

#attempt?(times_called) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/rr/times_called_matchers/range_matcher.rb', line 14

def attempt?(times_called)
  possible_match?(times_called)
end

#matches?(times_called) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/rr/times_called_matchers/range_matcher.rb', line 10

def matches?(times_called)
  @times.include?(times_called)
end

#possible_match?(times_called) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
# File 'lib/rr/times_called_matchers/range_matcher.rb', line 4

def possible_match?(times_called)
  return true if times_called < @times.begin
  return true if @times.include?(times_called)
  return false
end