Rufus::Scheduler::EveryJob

Recurring job with a certain frequency.

Attributes

frequency[R]

The frequency, in seconds, of this EveryJob

Public Class Methods

new(scheduler, t, params, &block) click to toggle source
     # File lib/rufus/sc/jobs.rb, line 257
257:     def initialize(scheduler, t, params, &block)
258:       super
259:       determine_frequency
260:       determine_at
261:     end

Public Instance Methods

trigger() click to toggle source

Triggers the job (and reschedules it).

     # File lib/rufus/sc/jobs.rb, line 265
265:     def trigger
266: 
267:       schedule_next
268: 
269:       super
270:     end

Protected Instance Methods

determine_at() click to toggle source
     # File lib/rufus/sc/jobs.rb, line 280
280:     def determine_at
281: 
282:       return unless @frequency
283: 
284:       @last = @at
285:         # the first time, @last will be nil
286: 
287:       @at = if @last
288:         @last + @frequency
289:       else
290:         if fi = @params[:first_in]
291:           Time.now.to_f + Rufus.duration_to_f(fi)
292:         elsif fa = @params[:first_at]
293:           Rufus.at_to_f(fa)
294:         else
295:           Time.now.to_f + @frequency
296:         end
297:       end
298:     end
determine_frequency() click to toggle source
     # File lib/rufus/sc/jobs.rb, line 274
274:     def determine_frequency
275: 
276:       @frequency = @t.is_a?(Fixnum) || @t.is_a?(Float) ?
277:         @t : Rufus.parse_duration_string(@t)
278:     end
schedule_next() click to toggle source

It’s an every job, have to schedule next time it occurs...

     # File lib/rufus/sc/jobs.rb, line 302
302:     def schedule_next
303: 
304:       determine_at
305: 
306:       @scheduler.send(:add_job, self)
307:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.