Class: Wheneverd::DSL::PeriodStrategy::SymbolStrategy
- Defined in:
- lib/wheneverd/dsl/period_strategy/symbol_strategy.rb
Overview
Strategy for parsing Symbol period values.
Handles calendar symbols like :day, :monday, :weekend, etc.
Constant Summary collapse
- REBOOT_NOT_SUPPORTED_MESSAGE =
"The :reboot period is not supported; use an interval or calendar period instead"
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
13 14 15 |
# File 'lib/wheneverd/dsl/period_strategy/symbol_strategy.rb', line 13 def handles?(period) period.is_a?(Symbol) end |
#parse(sym, at_times:) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/wheneverd/dsl/period_strategy/symbol_strategy.rb', line 17 def parse(sym, at_times:) raise_period_error(REBOOT_NOT_SUPPORTED_MESSAGE) if sym == :reboot if CALENDAR_SYMBOLS.include?(sym) return calendar_trigger( on_calendar: build_calendar_specs(sym.to_s, at_times) ) end raise_period_error("Unknown period symbol: #{sym.inspect}") end |