class Rufus::Scheduler::IntervalJob

Attributes

interval[R]

Public Class Methods

new(scheduler, interval, opts, block) click to toggle source
Calls superclass method Rufus::Scheduler::RepeatJob::new
# File lib/rufus/scheduler/jobs.rb, line 607
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

Public Instance Methods

next_time_from(time) click to toggle source
# File lib/rufus/scheduler/jobs.rb, line 621
def next_time_from(time)

  time + @mean_work_time + @interval
end

Protected Instance Methods

set_next_time(trigger_time, is_post=false) click to toggle source
# File lib/rufus/scheduler/jobs.rb, line 628
def set_next_time(trigger_time, is_post=false)

  @next_time =
    if is_post
      EoTime.now + @interval
    elsif trigger_time.nil?
      if @first_at == nil || @first_at < Time.now
        EoTime.now + @interval
      else
        @first_at
      end
    else
      false
    end
end