Class: Legion::Gaia::NotificationGate::ScheduleEvaluator
- Inherits:
-
Object
- Object
- Legion::Gaia::NotificationGate::ScheduleEvaluator
- Defined in:
- lib/legion/gaia/notification_gate/schedule_evaluator.rb
Constant Summary collapse
- DAY_NAMES =
%w[sun mon tue wed thu fri sat].freeze
Instance Method Summary collapse
-
#initialize(schedule: []) ⇒ ScheduleEvaluator
constructor
A new instance of ScheduleEvaluator.
- #quiet?(at: Time.now) ⇒ Boolean
Constructor Details
#initialize(schedule: []) ⇒ ScheduleEvaluator
Returns a new instance of ScheduleEvaluator.
9 10 11 |
# File 'lib/legion/gaia/notification_gate/schedule_evaluator.rb', line 9 def initialize(schedule: []) @schedule = normalize_schedule(schedule) end |
Instance Method Details
#quiet?(at: Time.now) ⇒ Boolean
13 14 15 |
# File 'lib/legion/gaia/notification_gate/schedule_evaluator.rb', line 13 def quiet?(at: Time.now) @schedule.any? { |window| matches_window?(at, window) } end |