Class: Rufus::Scheduler::IntervalJob

Inherits:
EvInJob show all
Defined in:
lib/rufus/scheduler/jobs_repeat.rb

Constant Summary

Constants inherited from RepeatJob

RepeatJob::FIRSTS

Constants inherited from Job

Job::EoTime

Instance Attribute Summary collapse

Attributes inherited from RepeatJob

#first_at, #last_at, #paused_at, #times

Attributes inherited from Job

#callable, #count, #handler, #id, #last_time, #last_work_time, #locals, #mean_work_time, #name, #next_time, #opts, #original, #previous_time, #scheduled_at, #tags, #unscheduled_at

Instance Method Summary collapse

Methods inherited from EvInJob

#first_at=

Methods inherited from RepeatJob

#determine_id, #next_times, #occurrences, #pause, #paused?, #resume, #trigger

Methods inherited from Job

#[], #[]=, #call, #check_frequency, #entries, #has_key?, #keys, #kill, #next_times, #past?, #resume_discard_past=, #running?, #scheduled?, #source_location, #threads, #trigger, #trigger_off_schedule, #unschedule, #values

Constructor Details

#initialize(scheduler, interval, opts, block) ⇒ IntervalJob

Returns a new instance of IntervalJob.



223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/rufus/scheduler/jobs_repeat.rb', line 223

def initialize(scheduler, interval, opts, block)

  super(scheduler, interval, opts, block)

  @interval = Rufus::Scheduler.parse_in(@original)

  fail ArgumentError.new(
    "cannot schedule #{self.class} with an interval " +
    "of #{@interval.inspect} (#{@original.inspect})"
  ) if @interval <= 0

  set_next_time(nil)
end

Instance Attribute Details

#intervalObject (readonly)

Returns the value of attribute interval.



221
222
223
# File 'lib/rufus/scheduler/jobs_repeat.rb', line 221

def interval
  @interval
end

Instance Method Details

#next_time_from(time) ⇒ Object



237
238
239
240
# File 'lib/rufus/scheduler/jobs_repeat.rb', line 237

def next_time_from(time)

  time + @mean_work_time + @interval
end