lib/rufus/scheduler/cronline.rb in rufus-scheduler-3.1.9 vs lib/rufus/scheduler/cronline.rb in rufus-scheduler-3.1.10

- old
+ new

@@ -46,21 +46,21 @@ attr_reader :monthdays attr_reader :timezone def initialize(line) - raise ArgumentError.new( + fail ArgumentError.new( "not a string: #{line.inspect}" ) unless line.is_a?(String) @original = line items = line.split @timezone = items.pop if ZoTime.is_timezone?(items.last) - raise ArgumentError.new( + fail ArgumentError.new( "not a valid cronline : '#{line}'" ) unless items.length == 5 or items.length == 6 offset = items.length - 5 @@ -71,11 +71,11 @@ @months = parse_item(items[3 + offset], 1, 12) @weekdays, @monthdays = parse_weekdays(items[4 + offset]) [ @seconds, @minutes, @hours, @months ].each do |es| - raise ArgumentError.new( + fail ArgumentError.new( "invalid cronline: '#{line}'" ) if es && es.find { |e| ! e.is_a?(Fixnum) } end end @@ -325,11 +325,11 @@ items.each do |it| if m = it.match(/^(.+)#(l|-?[12345])$/) - raise ArgumentError.new( + fail ArgumentError.new( "ranges are not supported for monthdays (#{it})" ) if m[1].index('-') expr = it.gsub(/#l/, '#-1') @@ -338,11 +338,11 @@ else expr = it.dup WEEKDAYS.each_with_index { |a, i| expr.gsub!(/#{a}/, i.to_s) } - raise ArgumentError.new( + fail ArgumentError.new( "invalid weekday expression (#{it})" ) if expr !~ /^0*[0-7](-0*[0-7])?$/ its = expr.index('-') ? parse_range(expr, 0, 7) : [ Integer(expr) ] its = its.collect { |i| i == 7 ? 0 : i } @@ -360,11 +360,11 @@ return nil if item == '*' r = item.split(',').map { |i| parse_range(i.strip, min, max) }.flatten - raise ArgumentError.new( + fail ArgumentError.new( "found duplicates in #{item.inspect}" ) if r.uniq.size < r.size r = sc_sort(r) @@ -379,11 +379,11 @@ item = '*' + item if item.match(/^\//) m = item.match(RANGE_REGEX) - raise ArgumentError.new( + fail ArgumentError.new( "cannot parse #{item.inspect}" ) unless m sta = m[1] sta = sta == '*' ? min : sta.to_i @@ -393,10 +393,10 @@ edn = max if m[1] == '*' inc = m[3] inc = inc ? inc.to_i : 1 - raise ArgumentError.new( + fail ArgumentError.new( "#{item.inspect} is not in range #{min}..#{max}" ) if sta < min || edn > max r = [] val = sta