Class: PeriodicJob::Scheduler
- Inherits:
-
Object
- Object
- PeriodicJob::Scheduler
- Defined in:
- lib/periodic_job_mongoid/scheduler.rb
Instance Method Summary collapse
- #after(&block) ⇒ Object
- #before(&block) ⇒ Object
- #error_handler(&block) ⇒ Object
- #every(interval, job_id, &block) ⇒ Object
-
#initialize ⇒ Scheduler
constructor
A new instance of Scheduler.
- #tick ⇒ Object
Constructor Details
#initialize ⇒ Scheduler
Returns a new instance of Scheduler.
6 7 8 |
# File 'lib/periodic_job_mongoid/scheduler.rb', line 6 def initialize @jobs = [] end |
Instance Method Details
#after(&block) ⇒ Object
26 27 28 |
# File 'lib/periodic_job_mongoid/scheduler.rb', line 26 def after(&block) @after = block end |
#before(&block) ⇒ Object
22 23 24 |
# File 'lib/periodic_job_mongoid/scheduler.rb', line 22 def before(&block) @before = block end |
#error_handler(&block) ⇒ Object
18 19 20 |
# File 'lib/periodic_job_mongoid/scheduler.rb', line 18 def error_handler(&block) @error_handler = block end |
#every(interval, job_id, &block) ⇒ Object
10 11 12 |
# File 'lib/periodic_job_mongoid/scheduler.rb', line 10 def every(interval, job_id, &block) @jobs << Job.new(interval, job_id, block, @error_handler, @before, @after) end |
#tick ⇒ Object
14 15 16 |
# File 'lib/periodic_job_mongoid/scheduler.rb', line 14 def tick @jobs.each &:tick end |