Class: Montrose::Rule::NthDayMatcher
- Inherits:
-
Object
- Object
- Montrose::Rule::NthDayMatcher
- Extended by:
- Forwardable
- Defined in:
- lib/montrose/rule/nth_day_matcher.rb
Instance Method Summary collapse
-
#initialize(wday, period_day) ⇒ NthDayMatcher
constructor
A new instance of NthDayMatcher.
- #matches?(nth_occ) ⇒ Boolean
Constructor Details
#initialize(wday, period_day) ⇒ NthDayMatcher
Returns a new instance of NthDayMatcher.
12 13 14 15 |
# File 'lib/montrose/rule/nth_day_matcher.rb', line 12 def initialize(wday, period_day) @wday = wday @period_day = period_day end |
Instance Method Details
#matches?(nth_occ) ⇒ Boolean
17 18 19 |
# File 'lib/montrose/rule/nth_day_matcher.rb', line 17 def matches?(nth_occ) nth_occ == current_occ || (nth_occ < 0 && (total_occ + nth_occ + 1) == current_occ) end |