lib/fugit/nat.rb in fugit-1.3.6 vs lib/fugit/nat.rb in fugit-1.3.7
- old
+ new
@@ -94,13 +94,17 @@
case e[2]
when 's', 'sec', 'second', 'seconds'
h[:sec] = eone(e)
when 'm', 'min', 'mins', 'minute', 'minutes'
- #(h[:hms] ||= []) << [ '*', eone(e) ]
h[:hms] ||= [ [ '*', eone(e) ] ]
when 'h', 'hour', 'hours'
- h[:hms] ||= [ [ eone(e), 0 ] ]
+ hms = h[:hms]
+ if hms && hms.size == 1 && hms.first.first == '*'
+ hms.first[0] = eone(e)
+ elsif ! hms
+ h[:hms] = [ [ eone(e), 0 ] ]
+ end
when 'd', 'day', 'days'
h[:dom] = "*/#{e1}" if e1 > 1
h[:hms] ||= [ [ 0, 0 ] ]
when 'w', 'week', 'weeks'
h[:_fail] = "cannot have crons for \"every #{e1} weeks\"" if e1 > 1