Class: Rufus::Scheduler::IntervalJob

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

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, #mean_work_time, #next_time, #opts, #original, #scheduled_at, #tags, #unscheduled_at

Instance Method Summary collapse

Methods inherited from EvInJob

#first_at=

Methods inherited from RepeatJob

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

Methods inherited from Job

#[], #[]=, #call, #key?, #keys, #kill, #running?, #scheduled?, #threads, #trigger, #unschedule

Constructor Details

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

Returns a new instance of IntervalJob

Raises:

  • (ArgumentError)


560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/rufus/scheduler/jobs.rb', line 560

def initialize(scheduler, interval, opts, block)

  super(scheduler, interval, opts, block)

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

  raise 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



558
559
560
# File 'lib/rufus/scheduler/jobs.rb', line 558

def interval
  @interval
end