Class: ISPMonitor::Scheduler
- Inherits:
-
Object
- Object
- ISPMonitor::Scheduler
- Defined in:
- lib/isp_monitor/scheduler.rb
Instance Attribute Summary collapse
-
#rufus_scheduler ⇒ Object
readonly
Returns the value of attribute rufus_scheduler.
Instance Method Summary collapse
-
#initialize ⇒ Scheduler
constructor
A new instance of Scheduler.
- #join ⇒ Object
- #schedule(checks) ⇒ Object
- #shutdown(*args) ⇒ Object
Constructor Details
#initialize ⇒ Scheduler
Returns a new instance of Scheduler.
4 5 6 |
# File 'lib/isp_monitor/scheduler.rb', line 4 def initialize @rufus_scheduler = Rufus::Scheduler.new end |
Instance Attribute Details
#rufus_scheduler ⇒ Object (readonly)
Returns the value of attribute rufus_scheduler.
2 3 4 |
# File 'lib/isp_monitor/scheduler.rb', line 2 def rufus_scheduler @rufus_scheduler end |
Instance Method Details
#join ⇒ Object
16 17 18 |
# File 'lib/isp_monitor/scheduler.rb', line 16 def join rufus_scheduler.join end |
#schedule(checks) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/isp_monitor/scheduler.rb', line 8 def schedule(checks) checks.map do |check| rufus_scheduler.every(check.interval, overlap: false) do check.run end end end |
#shutdown(*args) ⇒ Object
20 21 22 |
# File 'lib/isp_monitor/scheduler.rb', line 20 def shutdown(*args) rufus_scheduler.shutdown(*args) end |