lib/rufus/scheduler/jobs_repeat.rb in rufus-scheduler-3.9.0 vs lib/rufus/scheduler/jobs_repeat.rb in rufus-scheduler-3.9.1
- old
+ new
@@ -13,10 +13,12 @@
@paused_at = nil
@times = opts[:times]
+ @first_at_no_error = opts[:first_at_no_error] || false
+
fail ArgumentError.new(
"cannot accept :times => #{@times.inspect}, not nil or an int"
) unless @times == nil || @times.is_a?(Integer)
self.first_at =
@@ -41,10 +43,11 @@
first = n0 if FIRSTS.include?(first)
fdur = Rufus::Scheduler.parse_duration(first, no_error: true)
@first_at = (fdur && (EoTime.now + fdur)) || EoTime.make(first)
@first_at = n1 if @first_at >= n0 && @first_at < n1
+ @first_at = n0 if @first_at < n0 && @first_at_no_error
fail ArgumentError.new(
"cannot set first[_at|_in] in the past: " +
"#{first.inspect} -> #{@first_at.inspect}"
) if @first_at < n0
@@ -317,6 +320,5 @@
else
@cron_line.next_time(t)
end
end
end
-