Class: OnCalendar::Condition::Year
- Defined in:
- lib/on_calendar/condition/year.rb
Constant Summary collapse
- RANGE =
(1970..2200)
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(base: nil, step: nil, wildcard: false) ⇒ Year
constructor
A new instance of Year.
Methods inherited from Base
#distance_to_next, #match?, #range, range_bounds, #valid?
Constructor Details
#initialize(base: nil, step: nil, wildcard: false) ⇒ Year
Returns a new instance of Year.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/on_calendar/condition/year.rb', line 8 def initialize(base: nil, step: nil, wildcard: false) # Translate short year to long unless base.nil? if base.is_a?(Range) values = [ translate_short_year(base.begin), translate_short_year(base.end) ] base = (values.min..values.max) else base = translate_short_year(base) end end super end |