Class: Allora::Job::EveryJob
- Inherits:
-
Allora::Job
- Object
- Allora::Job
- Allora::Job::EveryJob
- Defined in:
- lib/allora/job/every_job.rb
Overview
A very simple job type that simply repeats every n seconds.
Instance Attribute Summary
Attributes inherited from Allora::Job
Instance Method Summary collapse
-
#initialize(n, &block) ⇒ EveryJob
constructor
Initialize the job to run every
nseconds. - #next_at(from_time) ⇒ Object
Methods inherited from Allora::Job
Constructor Details
#initialize(n, &block) ⇒ EveryJob
Initialize the job to run every n seconds.
You may use ActiveSupport’s numeric helpers, if you have ActiveSupport available.
38 39 40 41 42 |
# File 'lib/allora/job/every_job.rb', line 38 def initialize(n, &block) @duration = n super(&block) end |
Instance Method Details
#next_at(from_time) ⇒ Object
44 45 46 |
# File 'lib/allora/job/every_job.rb', line 44 def next_at(from_time) from_time + @duration end |