Class: Wheneverd::DSL::PeriodStrategy::ArrayStrategy
- Defined in:
- lib/wheneverd/dsl/period_strategy/array_strategy.rb
Overview
Strategy for parsing Array period values.
Handles arrays of calendar symbols like [:monday, :wednesday, :friday].
Constant Summary
Constants inherited from Base
Base::CALENDAR_SYMBOLS, Base::DAY_SECONDS
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Wheneverd::DSL::PeriodStrategy::Base
Instance Method Details
#handles?(period) ⇒ Boolean
12 13 14 |
# File 'lib/wheneverd/dsl/period_strategy/array_strategy.rb', line 12 def handles?(period) period.is_a?(Array) end |
#parse(periods, at_times:) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wheneverd/dsl/period_strategy/array_strategy.rb', line 16 def parse(periods, at_times:) bases = CalendarSymbolPeriodList.validate( periods, allowed_symbols: CALENDAR_SYMBOLS, path: path ).map(&:to_s) specs = bases.flat_map { |base| build_calendar_specs(base, at_times) }.uniq calendar_trigger(on_calendar: specs) end |