Method: Event#reschedule
- Defined in:
- lib/event.rb
#reschedule(by_seconds = 0, postpone_stop = true) ⇒ Object Also known as: postpone
Will reinitalize the Scheduled event with start time beeing the current time. This results in seconds_left beeing the next positive amount (or nil if not postpone_stop and next event would be after @stop) Useful together with Scheduled#off, Scheduled#on
152 153 154 155 156 157 158 159 |
# File 'lib/event.rb', line 152 def reschedule(by_seconds=0, postpone_stop=true) raise "Cannot postpone finished events." if @finished @next = calculate_first(Time.now+by_seconds) finished if !@next || (!postpone_stop && @stop && @next > @stop) update_scheduler @next end |