Class: PeriodicJob::Job
- Inherits:
-
Object
- Object
- PeriodicJob::Job
- Defined in:
- lib/periodic_job_mongoid/job.rb
Instance Attribute Summary collapse
-
#after ⇒ Object
readonly
Returns the value of attribute after.
-
#before ⇒ Object
readonly
Returns the value of attribute before.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#error_handler ⇒ Object
readonly
Returns the value of attribute error_handler.
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
-
#job_id ⇒ Object
readonly
Returns the value of attribute job_id.
-
#run_after ⇒ Object
readonly
Returns the value of attribute run_after.
Instance Method Summary collapse
- #checkpoint ⇒ Object
-
#initialize(interval, job_id, block, error_handler, before, after) ⇒ Job
constructor
A new instance of Job.
- #tick ⇒ Object
Constructor Details
#initialize(interval, job_id, block, error_handler, before, after) ⇒ Job
Returns a new instance of Job.
13 14 15 16 17 18 19 20 21 |
# File 'lib/periodic_job_mongoid/job.rb', line 13 def initialize(interval, job_id, block, error_handler, before, after) @interval = interval @job_id = job_id @block = block @error_handler = error_handler @before = before @after = after schedule end |
Instance Attribute Details
#after ⇒ Object (readonly)
Returns the value of attribute after.
11 12 13 |
# File 'lib/periodic_job_mongoid/job.rb', line 11 def after @after end |
#before ⇒ Object (readonly)
Returns the value of attribute before.
10 11 12 |
# File 'lib/periodic_job_mongoid/job.rb', line 10 def before @before end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
7 8 9 |
# File 'lib/periodic_job_mongoid/job.rb', line 7 def block @block end |
#error_handler ⇒ Object (readonly)
Returns the value of attribute error_handler.
9 10 11 |
# File 'lib/periodic_job_mongoid/job.rb', line 9 def error_handler @error_handler end |
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
5 6 7 |
# File 'lib/periodic_job_mongoid/job.rb', line 5 def interval @interval end |
#job_id ⇒ Object (readonly)
Returns the value of attribute job_id.
6 7 8 |
# File 'lib/periodic_job_mongoid/job.rb', line 6 def job_id @job_id end |
#run_after ⇒ Object (readonly)
Returns the value of attribute run_after.
8 9 10 |
# File 'lib/periodic_job_mongoid/job.rb', line 8 def run_after @run_after end |
Instance Method Details
#checkpoint ⇒ Object
23 24 25 |
# File 'lib/periodic_job_mongoid/job.rb', line 23 def checkpoint Checkpoint[@job_id] end |
#tick ⇒ Object
27 28 29 30 31 32 |
# File 'lib/periodic_job_mongoid/job.rb', line 27 def tick if checkpoint.advance_if_older_than @run_after run schedule end end |