lib/rufus/sc/jobs.rb in rufus-scheduler-2.0.18 vs lib/rufus/sc/jobs.rb in rufus-scheduler-2.0.19
- old
+ new
@@ -363,14 +363,19 @@
protected
def determine_frequency
- @frequency = if @t.is_a?(Fixnum) || @t.is_a?(Float)
- @t
- else
- Rufus.parse_duration_string(@t)
- end
+ @frequency =
+ if @t.is_a?(Fixnum) || @t.is_a?(Float)
+ @t
+ else
+ Rufus.parse_duration_string(@t)
+ end
+
+ raise ArgumentError.new(
+ 'cannot initialize an EveryJob with a <= 0.0 frequency'
+ ) if @frequency <= 0.0
end
def determine_at
return unless @frequency