Class: Scheduler::Schedulable::Delayed
- Inherits:
-
Object
- Object
- Scheduler::Schedulable::Delayed
- Defined in:
- lib/scheduler/schedulable.rb
Overview
A class to delay jobs.
Instance Method Summary collapse
-
#initialize(job_class, time) ⇒ Delayed
constructor
New delayed job.
-
#schedule(executable_class, *job_args) ⇒ Object
Creates an instance of this class and schedules the job.
Constructor Details
#initialize(job_class, time) ⇒ Delayed
New delayed job.
18 19 20 21 |
# File 'lib/scheduler/schedulable.rb', line 18 def initialize(job_class, time) @job_class = job_class @time = time end |
Instance Method Details
#schedule(executable_class, *job_args) ⇒ Object
Creates an instance of this class and schedules the job.
30 31 32 |
# File 'lib/scheduler/schedulable.rb', line 30 def schedule(executable_class, *job_args) @job_class.create(executable_class: executable_class, args: job_args, run_at: Time.now + @time).schedule end |