Class: Repeatable::Expression::RangeInYear
- Defined in:
- lib/repeatable/expression/range_in_year.rb
Instance Method Summary collapse
- #include?(date) ⇒ Boolean
-
#initialize(start_month:, end_month: start_month, start_day: 0, end_day: 0) ⇒ RangeInYear
constructor
A new instance of RangeInYear.
Methods inherited from Date
Methods inherited from Base
===, #deconstruct_keys, #difference, #intersection, #to_h, #union
Constructor Details
#initialize(start_month:, end_month: start_month, start_day: 0, end_day: 0) ⇒ RangeInYear
Returns a new instance of RangeInYear.
14 15 16 17 18 19 |
# File 'lib/repeatable/expression/range_in_year.rb', line 14 def initialize(start_month:, end_month: start_month, start_day: 0, end_day: 0) @start_month = start_month @end_month = end_month @start_day = start_day @end_day = end_day end |
Instance Method Details
#include?(date) ⇒ Boolean
22 23 24 25 26 27 28 29 30 |
# File 'lib/repeatable/expression/range_in_year.rb', line 22 def include?(date) return true if months_include?(date) if start_month == end_month start_month_include?(date) && end_month_include?(date) else start_month_include?(date) || end_month_include?(date) end end |