Class: Forcast::Jobs::JobsWrapper::Repetitive
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- Forcast::Jobs::JobsWrapper::Repetitive
- Defined in:
- lib/forcast/jobs/jobs_wrapper.rb
Instance Method Summary collapse
Instance Method Details
#perform(callback, array, t, interval, unidad) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/forcast/jobs/jobs_wrapper.rb', line 10 def perform(callback,array,t,interval,unidad) vas = eval(callback) unidad = 'minutes' unless units.include?(unidad) i = interval || 1 t = (t/i).round || 1 t.times do |time| vas.perform_at(((time+1)*interval).send(unidad).from_now,array) end end |
#units ⇒ Object
19 20 21 |
# File 'lib/forcast/jobs/jobs_wrapper.rb', line 19 def units return ['seconds','minutes','hours','days'] end |