Class: OpenWFE::CronJob
Overview
A cron job.
Instance Attribute Summary collapse
-
#cron_line ⇒ Object
The CronLine instance representing the times at which the cron job has to be triggered.
Attributes inherited from Job
#block, #job_id, #params, #scheduler, #tags
Instance Method Summary collapse
-
#initialize(scheduler, cron_id, line, params, &block) ⇒ CronJob
constructor
A new instance of CronJob.
-
#matches?(time) ⇒ Boolean
This is the method called by the scheduler to determine if it has to fire this CronJob instance.
-
#schedule_info ⇒ Object
Returns the original cron tab string used to schedule this Job.
-
#trigger ⇒ Object
As the name implies.
Methods inherited from Job
Constructor Details
#initialize(scheduler, cron_id, line, params, &block) ⇒ CronJob
Returns a new instance of CronJob.
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 |
# File 'lib/openwfe/util/scheduler.rb', line 1025 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 |
Instance Attribute Details
#cron_line ⇒ Object
The CronLine instance representing the times at which the cron job has to be triggered.
1023 1024 1025 |
# File 'lib/openwfe/util/scheduler.rb', line 1023 def cron_line @cron_line end |
Instance Method Details
#matches?(time) ⇒ Boolean
This is the method called by the scheduler to determine if it has to fire this CronJob instance.
1049 1050 1051 1052 |
# File 'lib/openwfe/util/scheduler.rb', line 1049 def matches? (time) @cron_line.matches? time end |
#schedule_info ⇒ Object
Returns the original cron tab string used to schedule this Job. Like for example “60/3 * * * Sun”.
1066 1067 1068 1069 |
# File 'lib/openwfe/util/scheduler.rb', line 1066 def schedule_info @cron_line.original end |
#trigger ⇒ Object
As the name implies.
1057 1058 1059 1060 |
# File 'lib/openwfe/util/scheduler.rb', line 1057 def trigger @block.call @job_id, @cron_line end |