Period should only return future time

This commit is contained in:
Dzmitry Plashchynski committed 2015-04-12 16:48:57 +03:00
1 parent 55e3956618
commit f6b393ad6b
2 files changed
+17 -10

No files matched your search

+4 -2
View File
@@ -1,5 +1,5 @@
module Crono
# Period describe frequency of performing a task
# Period describe frequency of jobs
class Period
DAYS = [:monday, :tuesday, :wednesday, :thursday, :friday, :saturday,
:sunday]
@@ -14,7 +14,9 @@ module Crono
return initial_next unless since
@next = @period.since(since)
@next = @next.beginning_of_week.advance(days: @on) if @on
@next.change(time_atts)
@next = @next.change(time_atts)
return @next if @next.future?
Time.now
end
def description