a little refactoring

This commit is contained in:
John Bintz 2010-01-04 22:00:34 -05:00
parent 46856b7b05
commit 2758239c1a

View File

@ -50,26 +50,25 @@ class Scheduler
while dates.length < to_produce while dates.length < to_produce
interval = parameters['interval'].shift interval = parameters['interval'].shift
case interval.class.to_s what_to_add = nil
when 'String'
if interval.is_a? String
current = skip_to_dow(current, interval) current = skip_to_dow(current, interval)
what_to_add = 1
end
if ok_to_add(current, index, prior, breaks) if ok_to_add(current, index, prior, breaks)
dates << current dates << current
prior = current prior = current
index += 1 index += 1
end end
current += 1 if interval.is_a? Fixnum
when 'Fixnum' what_to_add = interval
if ok_to_add(current, index, prior, breaks)
dates << current
prior = current
index += 1
end end
current += interval current += what_to_add
end
parameters['interval'] << interval parameters['interval'] << interval
end end