Class OpenWFE::CronJob
In: lib/openwfe/util/scheduler.rb
Parent: Job

A cron job.

Methods

matches?   new   schedule_info   trigger  

Attributes

cron_line  [RW]  The CronLine instance representing the times at which the cron job has to be triggered.

Public Class methods

[Source]

      # File lib/openwfe/util/scheduler.rb, line 1096
1096:             def initialize (scheduler, cron_id, line, params, &block)
1097: 
1098:                 super(scheduler, cron_id, params, &block)
1099: 
1100:                 if line.is_a?(String)
1101: 
1102:                     @cron_line = CronLine.new(line)
1103: 
1104:                 elsif line.is_a?(CronLine)
1105: 
1106:                     @cron_line = line
1107: 
1108:                 else
1109: 
1110:                     raise \
1111:                         "Cannot initialize a CronJob " +
1112:                         "with a param of class #{line.class}"
1113:                 end
1114:             end

Public Instance methods

This is the method called by the scheduler to determine if it has to fire this CronJob instance.

[Source]

      # File lib/openwfe/util/scheduler.rb, line 1120
1120:             def matches? (time)
1121: 
1122:                 @cron_line.matches? time
1123:             end

Returns the original cron tab string used to schedule this Job. Like for example "60/3 * * * Sun".

[Source]

      # File lib/openwfe/util/scheduler.rb, line 1137
1137:             def schedule_info
1138: 
1139:                 @cron_line.original
1140:             end

As the name implies.

[Source]

      # File lib/openwfe/util/scheduler.rb, line 1128
1128:             def trigger
1129: 
1130:                 @block.call @job_id, @cron_line
1131:             end

[Validate]