class Rufus::Scheduler::CronJob

Recurring job, cron style.

Attributes

block[R]

The block to call when triggering

cron_line[R]

The CronLine instance, it holds all the info about the cron schedule

params[R]

The job parameters (passed via the schedule method)

Public Class Methods

new(scheduler, cron_string, params, &block) click to toggle source

Creates a new CronJob instance.

# File lib/rufus/sc/jobs.rb, line 323
def initialize (scheduler, cron_string, params, &block)

  super

  @cron_line = case @t

    when String then CronLine.new(@t)
    when CronLine then @t

    else raise "cannot initialize a CronJob out of #{@t.inspect}"
  end
end

Public Instance Methods

next_time(from=Time.now) click to toggle source

Returns the next time this job is meant to trigger

# File lib/rufus/sc/jobs.rb, line 343
def next_time (from=Time.now)

  @cron_line.next_time(from)
end
trigger_if_matches(time) click to toggle source
# File lib/rufus/sc/jobs.rb, line 336
def trigger_if_matches (time)

  trigger(time) if @cron_line.matches?(time)
end

Protected Instance Methods

determine_at() click to toggle source
# File lib/rufus/sc/jobs.rb, line 350
def determine_at
  # empty
end