class Rufus::CronJob
A cron job.
def initialize (scheduler, cron_id, line, params, &block)
def initialize (scheduler, cron_id, line, params, &block) super(scheduler, cron_id, params, &block) if line.is_a?(String) @cron_line = CronLine.new(line) elsif line.is_a?(CronLine) @cron_line = line else raise \ "Cannot initialize a CronJob " + "with a param of class #{line.class}" end end
def matches? (time)
has to fire this CronJob instance.
This is the method called by the scheduler to determine if it
def matches? (time) #def matches? (time, precision) #@cron_line.matches?(time, precision) @cron_line.matches?(time) end
def next_time (from=Time.now)
what will be the next time. Defaults to now.
'from' is used to specify the starting point for determining
supposed to "fire".
Returns a Time instance : the next time this cron job is
def next_time (from=Time.now) @cron_line.next_time(from) end
def schedule_info
Job. Like for example "60/3 * * * Sun".
Returns the original cron tab string used to schedule this
def schedule_info @cron_line.original end
def trigger
As the name implies.
def trigger @block.call @job_id, @cron_line, @params end