Class: Repeatable::Expression::Biweekly
- Inherits:
-
Date
- Object
- Base
- Date
- Repeatable::Expression::Biweekly
show all
- Defined in:
- lib/repeatable/expression/biweekly.rb
Instance Method Summary
collapse
Methods inherited from Date
#==, #hash
Methods inherited from Base
===, #deconstruct_keys, #difference, #intersection, #to_h, #union
Constructor Details
#initialize(weekday:, start_after: ::Date.today) ⇒ void
7
8
9
10
11
|
# File 'lib/repeatable/expression/biweekly.rb', line 7
def initialize(weekday:, start_after: ::Date.today)
@weekday = weekday
@start_after = T.let(Conversions::Date(start_after), ::Date)
@_first_occurrence = T.let(find_first_occurrence, ::Date)
end
|
Instance Method Details
#include?(date) ⇒ Boolean
14
15
16
|
# File 'lib/repeatable/expression/biweekly.rb', line 14
def include?(date)
date >= start_after && (date - _first_occurrence) % 14 == 0
end
|