Class: Cronic::Scheduler

Inherits:
Object
  • Object
show all
Defined in:
lib/cronic/scheduler.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Scheduler

Returns a new instance of Scheduler.



12
13
14
15
# File 'lib/cronic/scheduler.rb', line 12

def initialize(opts = {})
  @rufus_scheduler = Rufus::Scheduler.start_new(opts)
  setup_exception_handler
end

Instance Method Details

#joinObject

blocks until the scheduler exits for some reason



22
23
24
# File 'lib/cronic/scheduler.rb', line 22

def join
  @rufus_scheduler.join
end

#load_jobs(file) ⇒ Object



17
18
19
# File 'lib/cronic/scheduler.rb', line 17

def load_jobs(file)
  @rufus_scheduler.instance_eval IO.read file
end