rufus-scheduler 1.0.14 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.txt +2 -82
- data/CREDITS.txt +8 -2
- data/README.rdoc +359 -0
- data/TODO.txt +51 -0
- data/lib/rufus-scheduler.rb +1 -1
- data/lib/rufus/otime.rb +1 -1
- data/lib/rufus/{scheduler → sc}/cronline.rb +44 -80
- data/lib/rufus/sc/jobqueues.rb +157 -0
- data/lib/rufus/sc/jobs.rb +339 -0
- data/lib/rufus/{scheduler/otime.rb → sc/rtime.rb} +35 -45
- data/lib/rufus/sc/scheduler.rb +454 -0
- data/lib/rufus/scheduler.rb +53 -1
- data/spec/spec.rb +14 -0
- metadata +14 -11
- data/README.txt +0 -118
- data/lib/rufus/scheduler/jobs.rb +0 -334
- data/lib/rufus/scheduler/scheduler.rb +0 -1082
- data/test/test.rb +0 -20
data/lib/rufus/scheduler.rb
CHANGED
@@ -1,3 +1,55 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2006-2009, John Mettraux, jmettraux@gmail.com
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#
|
22
|
+
# Made in Japan.
|
23
|
+
#++
|
1
24
|
|
2
|
-
|
25
|
+
|
26
|
+
require 'rufus/sc/scheduler'
|
27
|
+
|
28
|
+
|
29
|
+
module Rufus::Scheduler
|
30
|
+
|
31
|
+
# A quick way to get a scheduler up an running
|
32
|
+
#
|
33
|
+
# require 'rubygems'
|
34
|
+
# s = Rufus::Scheduler.start_new
|
35
|
+
#
|
36
|
+
# If EventMachine is present and running will create an EmScheduler, else
|
37
|
+
# it will create a PlainScheduler instance.
|
38
|
+
#
|
39
|
+
def self.start_new (opts={})
|
40
|
+
|
41
|
+
if defined?(EM) and EM.reactor_running?
|
42
|
+
EmScheduler.start_new(opts)
|
43
|
+
else
|
44
|
+
PlainScheduler.start_new(opts)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns true if the given string seems to be a cron string.
|
49
|
+
#
|
50
|
+
def self.is_cron_string (s)
|
51
|
+
|
52
|
+
s.match('.+ .+ .+ .+ .+') # well...
|
53
|
+
end
|
54
|
+
end
|
3
55
|
|
data/spec/spec.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# specifying rufus-scheduler
|
4
|
+
#
|
5
|
+
# Fri Mar 20 22:54:46 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
specs = Dir["#{File.dirname(__FILE__)}/*_spec.rb"]
|
9
|
+
|
10
|
+
#specs = specs - [ 'spec/stress_schedule_unschedule_spec.rb' ]
|
11
|
+
# this spec was a bit longish (11m) now it's OK (66.78s)
|
12
|
+
|
13
|
+
specs.each { |path| load(path) }
|
14
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-07 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -20,23 +20,26 @@ executables: []
|
|
20
20
|
extensions: []
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
23
|
-
- README.
|
23
|
+
- README.rdoc
|
24
24
|
- CHANGELOG.txt
|
25
25
|
- CREDITS.txt
|
26
|
+
- LICENSE.txt
|
26
27
|
files:
|
27
28
|
- lib/rufus/otime.rb
|
28
|
-
- lib/rufus/
|
29
|
-
- lib/rufus/
|
30
|
-
- lib/rufus/
|
31
|
-
- lib/rufus/
|
29
|
+
- lib/rufus/sc/cronline.rb
|
30
|
+
- lib/rufus/sc/jobqueues.rb
|
31
|
+
- lib/rufus/sc/jobs.rb
|
32
|
+
- lib/rufus/sc/rtime.rb
|
33
|
+
- lib/rufus/sc/scheduler.rb
|
32
34
|
- lib/rufus/scheduler.rb
|
33
35
|
- lib/rufus-scheduler.rb
|
34
36
|
- CHANGELOG.txt
|
35
37
|
- CREDITS.txt
|
36
38
|
- LICENSE.txt
|
37
|
-
-
|
39
|
+
- TODO.txt
|
40
|
+
- README.rdoc
|
38
41
|
has_rdoc: true
|
39
|
-
homepage: http://
|
42
|
+
homepage: http://rufus.rubyforge.org/
|
40
43
|
licenses: []
|
41
44
|
|
42
45
|
post_install_message:
|
@@ -62,6 +65,6 @@ rubyforge_project: rufus
|
|
62
65
|
rubygems_version: 1.3.2
|
63
66
|
signing_key:
|
64
67
|
specification_version: 3
|
65
|
-
summary: scheduler for Ruby (at, cron and every jobs)
|
68
|
+
summary: job scheduler for Ruby (at, cron, in and every jobs)
|
66
69
|
test_files:
|
67
|
-
-
|
70
|
+
- spec/spec.rb
|
data/README.txt
DELETED
@@ -1,118 +0,0 @@
|
|
1
|
-
|
2
|
-
= rufus-scheduler
|
3
|
-
|
4
|
-
This gem was formerly known as 'openwferu-scheduler'. It has been repackaged as 'rufus-scheduler'. Old 'require' paths have been kept for backward compatibility (no need to update your code).
|
5
|
-
|
6
|
-
The new license is MIT (not much of a change, the previous license was BSD).
|
7
|
-
|
8
|
-
|
9
|
-
== getting it
|
10
|
-
|
11
|
-
sudo gem install rufus-scheduler
|
12
|
-
|
13
|
-
or at
|
14
|
-
|
15
|
-
http://rubyforge.org/frs/?group_id=4812
|
16
|
-
|
17
|
-
|
18
|
-
== usage
|
19
|
-
|
20
|
-
(the rdoc is at http://rufus.rubyforge.org/rufus-scheduler/)
|
21
|
-
|
22
|
-
some examples :
|
23
|
-
|
24
|
-
require 'rubygems'
|
25
|
-
require 'rufus/scheduler'
|
26
|
-
|
27
|
-
scheduler = Rufus::Scheduler.start_new
|
28
|
-
|
29
|
-
scheduler.in("3d") do
|
30
|
-
regenerate_monthly_report()
|
31
|
-
end
|
32
|
-
#
|
33
|
-
# will call the regenerate_monthly_report method
|
34
|
-
# in 3 days from now
|
35
|
-
|
36
|
-
scheduler.every "10m10s" do
|
37
|
-
check_score(favourite_team) # every 10 minutes and 10 seconds
|
38
|
-
end
|
39
|
-
|
40
|
-
scheduler.cron "0 22 * * 1-5" do
|
41
|
-
log.info "activating security system..."
|
42
|
-
activate_security_system()
|
43
|
-
end
|
44
|
-
|
45
|
-
job_id = scheduler.at "Sun Oct 07 14:24:01 +0900 2009" do
|
46
|
-
init_self_destruction_sequence()
|
47
|
-
end
|
48
|
-
|
49
|
-
scheduler.join # join the scheduler (prevents exiting)
|
50
|
-
|
51
|
-
|
52
|
-
For all the scheduling related information, see the Rufus::Scheduler class rdoc itself (http://rufus.rubyforge.org/rufus-scheduler/classes/Rufus/Scheduler.html) or the original OpenWFEru scheduler documentation at http://openwferu.rubyforge.org/scheduler.html
|
53
|
-
|
54
|
-
Apart from scheduling, There are also two interesting methods in this gem, they are named parse_time_string and to_time_string :
|
55
|
-
|
56
|
-
require 'rubygems'
|
57
|
-
require 'rufus/otime' # gem 'rufus_scheduler'
|
58
|
-
|
59
|
-
Rufus.parse_time_string "500" # => 0.5
|
60
|
-
Rufus.parse_time_string "1000" # => 1.0
|
61
|
-
Rufus.parse_time_string "1h" # => 3600.0
|
62
|
-
Rufus.parse_time_string "1h10s" # => 3610.0
|
63
|
-
Rufus.parse_time_string "1w2d" # => 777600.0
|
64
|
-
|
65
|
-
Rufus.to_time_string 60 # => '1m'
|
66
|
-
Rufus.to_time_string 3661 # => '1h1m1s'
|
67
|
-
Rufus.to_time_string 7 * 24 * 3600 # => '1w'
|
68
|
-
|
69
|
-
|
70
|
-
Something about the rufus-scheduler, threads and ActiveRecord connections (warning : I'm mostly clueless about Rails) :
|
71
|
-
|
72
|
-
http://jmettraux.wordpress.com/2008/09/14/the-scheduler-and-the-active_record/
|
73
|
-
|
74
|
-
|
75
|
-
== dependencies
|
76
|
-
|
77
|
-
None.
|
78
|
-
|
79
|
-
|
80
|
-
== mailing list
|
81
|
-
|
82
|
-
On the rufus-ruby list[http://groups.google.com/group/rufus-ruby] :
|
83
|
-
|
84
|
-
http://groups.google.com/group/rufus-ruby
|
85
|
-
|
86
|
-
|
87
|
-
== issue tracker
|
88
|
-
|
89
|
-
http://rubyforge.org/tracker/?atid=18584&group_id=4812&func=browse
|
90
|
-
|
91
|
-
|
92
|
-
== irc
|
93
|
-
|
94
|
-
irc.freenode.net #ruote
|
95
|
-
|
96
|
-
|
97
|
-
== source
|
98
|
-
|
99
|
-
http://github.com/jmettraux/rufus-scheduler
|
100
|
-
|
101
|
-
git clone git://github.com/jmettraux/rufus-scheduler.git
|
102
|
-
|
103
|
-
|
104
|
-
== author
|
105
|
-
|
106
|
-
John Mettraux, jmettraux@gmail.com
|
107
|
-
http://jmettraux.wordpress.com
|
108
|
-
|
109
|
-
|
110
|
-
== the rest of Rufus
|
111
|
-
|
112
|
-
http://rufus.rubyforge.org
|
113
|
-
|
114
|
-
|
115
|
-
== license
|
116
|
-
|
117
|
-
MIT
|
118
|
-
|
data/lib/rufus/scheduler/jobs.rb
DELETED
@@ -1,334 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2006-2009, John Mettraux, jmettraux@gmail.com
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
# THE SOFTWARE.
|
21
|
-
#
|
22
|
-
# Made in Japan.
|
23
|
-
#++
|
24
|
-
|
25
|
-
|
26
|
-
module Rufus
|
27
|
-
|
28
|
-
JOB_ID_LOCK = Mutex.new
|
29
|
-
|
30
|
-
#
|
31
|
-
# The parent class for scheduled jobs.
|
32
|
-
#
|
33
|
-
class Job
|
34
|
-
|
35
|
-
@@last_given_id = 0
|
36
|
-
#
|
37
|
-
# as a scheduler is fully transient, no need to
|
38
|
-
# have persistent ids, a simple counter is sufficient
|
39
|
-
|
40
|
-
#
|
41
|
-
# The identifier for the job
|
42
|
-
#
|
43
|
-
attr_accessor :job_id
|
44
|
-
|
45
|
-
#
|
46
|
-
# An array of tags
|
47
|
-
#
|
48
|
-
attr_accessor :tags
|
49
|
-
|
50
|
-
#
|
51
|
-
# The block to execute at trigger time
|
52
|
-
#
|
53
|
-
attr_accessor :block
|
54
|
-
|
55
|
-
#
|
56
|
-
# A reference to the scheduler
|
57
|
-
#
|
58
|
-
attr_reader :scheduler
|
59
|
-
|
60
|
-
#
|
61
|
-
# Keeping a copy of the initialization params of the job.
|
62
|
-
#
|
63
|
-
attr_reader :params
|
64
|
-
|
65
|
-
#
|
66
|
-
# if the job is currently executing, this field points to
|
67
|
-
# the 'trigger thread'
|
68
|
-
#
|
69
|
-
attr_reader :trigger_thread
|
70
|
-
|
71
|
-
|
72
|
-
def initialize (scheduler, job_id, params, &block)
|
73
|
-
|
74
|
-
@scheduler = scheduler
|
75
|
-
@block = block
|
76
|
-
|
77
|
-
if job_id
|
78
|
-
@job_id = job_id
|
79
|
-
else
|
80
|
-
JOB_ID_LOCK.synchronize do
|
81
|
-
@job_id = @@last_given_id
|
82
|
-
@@last_given_id = @job_id + 1
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
@params = params
|
87
|
-
|
88
|
-
#@tags = Array(tags).collect { |tag| tag.to_s }
|
89
|
-
# making sure we have an array of String tags
|
90
|
-
|
91
|
-
@tags = Array(params[:tags])
|
92
|
-
# any tag is OK
|
93
|
-
end
|
94
|
-
|
95
|
-
#
|
96
|
-
# Returns true if this job sports the given tag
|
97
|
-
#
|
98
|
-
def has_tag? (tag)
|
99
|
-
|
100
|
-
@tags.include?(tag)
|
101
|
-
end
|
102
|
-
|
103
|
-
#
|
104
|
-
# Removes (cancels) this job from its scheduler.
|
105
|
-
#
|
106
|
-
def unschedule
|
107
|
-
|
108
|
-
@scheduler.unschedule(@job_id)
|
109
|
-
end
|
110
|
-
|
111
|
-
#
|
112
|
-
# Triggers the job (in a dedicated thread).
|
113
|
-
#
|
114
|
-
def trigger
|
115
|
-
|
116
|
-
t = Thread.new do
|
117
|
-
|
118
|
-
@trigger_thread = Thread.current
|
119
|
-
# keeping track of the thread
|
120
|
-
|
121
|
-
begin
|
122
|
-
|
123
|
-
do_trigger
|
124
|
-
|
125
|
-
rescue Exception => e
|
126
|
-
|
127
|
-
@scheduler.send(:log_exception, e)
|
128
|
-
end
|
129
|
-
|
130
|
-
#@trigger_thread = nil if @trigger_thread == Thread.current
|
131
|
-
@trigger_thread = nil
|
132
|
-
# overlapping executions, what to do ?
|
133
|
-
end
|
134
|
-
|
135
|
-
if t.alive? and (to = @params[:timeout])
|
136
|
-
@scheduler.in(to, :tags => 'timeout') do
|
137
|
-
@trigger_thread.raise(Rufus::TimeOutError) if t.alive?
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
def call_block
|
143
|
-
|
144
|
-
args = case @block.arity
|
145
|
-
when 0 then []
|
146
|
-
when 1 then [ @params ]
|
147
|
-
when 2 then [ @job_id, @params ]
|
148
|
-
else [ @job_id, schedule_info, @params ]
|
149
|
-
end
|
150
|
-
|
151
|
-
@block.call(*args)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
#
|
156
|
-
# An 'at' job.
|
157
|
-
#
|
158
|
-
class AtJob < Job
|
159
|
-
|
160
|
-
#
|
161
|
-
# The float representation (Time.to_f) of the time at which
|
162
|
-
# the job should be triggered.
|
163
|
-
#
|
164
|
-
attr_accessor :at
|
165
|
-
|
166
|
-
|
167
|
-
def initialize (scheduler, at, at_id, params, &block)
|
168
|
-
|
169
|
-
super(scheduler, at_id, params, &block)
|
170
|
-
@at = at
|
171
|
-
end
|
172
|
-
|
173
|
-
#
|
174
|
-
# Returns the Time instance at which this job is scheduled.
|
175
|
-
#
|
176
|
-
def schedule_info
|
177
|
-
|
178
|
-
Time.at(@at)
|
179
|
-
end
|
180
|
-
|
181
|
-
#
|
182
|
-
# next_time is last_time (except for EveryJob instances). Returns
|
183
|
-
# a Time instance.
|
184
|
-
#
|
185
|
-
def next_time
|
186
|
-
|
187
|
-
schedule_info
|
188
|
-
end
|
189
|
-
|
190
|
-
protected
|
191
|
-
|
192
|
-
#
|
193
|
-
# Triggers the job (calls the block)
|
194
|
-
#
|
195
|
-
def do_trigger
|
196
|
-
|
197
|
-
call_block
|
198
|
-
|
199
|
-
@scheduler.instance_variable_get(:@non_cron_jobs).delete(@job_id)
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
#
|
204
|
-
# An 'every' job is simply an extension of an 'at' job.
|
205
|
-
#
|
206
|
-
class EveryJob < AtJob
|
207
|
-
|
208
|
-
#
|
209
|
-
# Returns the frequency string used to schedule this EveryJob,
|
210
|
-
# like for example "3d" or "1M10d3h".
|
211
|
-
#
|
212
|
-
def schedule_info
|
213
|
-
|
214
|
-
@params[:every]
|
215
|
-
end
|
216
|
-
|
217
|
-
protected
|
218
|
-
|
219
|
-
#
|
220
|
-
# triggers the job, then reschedules it if necessary
|
221
|
-
#
|
222
|
-
def do_trigger
|
223
|
-
|
224
|
-
hit_exception = false
|
225
|
-
|
226
|
-
begin
|
227
|
-
|
228
|
-
call_block
|
229
|
-
|
230
|
-
rescue Exception => e
|
231
|
-
|
232
|
-
@scheduler.send(:log_exception, e)
|
233
|
-
|
234
|
-
hit_exception = true
|
235
|
-
end
|
236
|
-
|
237
|
-
if \
|
238
|
-
@scheduler.instance_variable_get(:@exit_when_no_more_jobs) or
|
239
|
-
(@params[:dont_reschedule] == true) or
|
240
|
-
(hit_exception and @params[:try_again] == false)
|
241
|
-
|
242
|
-
@scheduler.instance_variable_get(:@non_cron_jobs).delete(job_id)
|
243
|
-
# maybe it'd be better to wipe that reference from here anyway...
|
244
|
-
|
245
|
-
return
|
246
|
-
end
|
247
|
-
|
248
|
-
#
|
249
|
-
# ok, reschedule ...
|
250
|
-
|
251
|
-
params[:job] = self
|
252
|
-
|
253
|
-
@at = @at + Rufus.duration_to_f(params[:every])
|
254
|
-
|
255
|
-
@scheduler.send(:do_schedule_at, @at, params)
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
#
|
260
|
-
# A cron job.
|
261
|
-
#
|
262
|
-
class CronJob < Job
|
263
|
-
|
264
|
-
#
|
265
|
-
# The CronLine instance representing the times at which
|
266
|
-
# the cron job has to be triggered.
|
267
|
-
#
|
268
|
-
attr_accessor :cron_line
|
269
|
-
|
270
|
-
def initialize (scheduler, cron_id, line, params, &block)
|
271
|
-
|
272
|
-
super(scheduler, cron_id, params, &block)
|
273
|
-
|
274
|
-
if line.is_a?(String)
|
275
|
-
|
276
|
-
@cron_line = CronLine.new(line)
|
277
|
-
|
278
|
-
elsif line.is_a?(CronLine)
|
279
|
-
|
280
|
-
@cron_line = line
|
281
|
-
|
282
|
-
else
|
283
|
-
|
284
|
-
raise(
|
285
|
-
"Cannot initialize a CronJob " +
|
286
|
-
"with a param of class #{line.class}")
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
|
-
#
|
291
|
-
# This is the method called by the scheduler to determine if it
|
292
|
-
# has to fire this CronJob instance.
|
293
|
-
#
|
294
|
-
def matches? (time)
|
295
|
-
#def matches? (time, precision)
|
296
|
-
|
297
|
-
#@cron_line.matches?(time, precision)
|
298
|
-
@cron_line.matches?(time)
|
299
|
-
end
|
300
|
-
|
301
|
-
#
|
302
|
-
# Returns the original cron tab string used to schedule this
|
303
|
-
# Job. Like for example "60/3 * * * Sun".
|
304
|
-
#
|
305
|
-
def schedule_info
|
306
|
-
|
307
|
-
@cron_line.original
|
308
|
-
end
|
309
|
-
|
310
|
-
#
|
311
|
-
# Returns a Time instance : the next time this cron job is
|
312
|
-
# supposed to "fire".
|
313
|
-
#
|
314
|
-
# 'from' is used to specify the starting point for determining
|
315
|
-
# what will be the next time. Defaults to now.
|
316
|
-
#
|
317
|
-
def next_time (from=Time.now)
|
318
|
-
|
319
|
-
@cron_line.next_time(from)
|
320
|
-
end
|
321
|
-
|
322
|
-
protected
|
323
|
-
|
324
|
-
#
|
325
|
-
# As the name implies.
|
326
|
-
#
|
327
|
-
def do_trigger
|
328
|
-
|
329
|
-
call_block
|
330
|
-
end
|
331
|
-
end
|
332
|
-
|
333
|
-
end
|
334
|
-
|