7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/crontab-parser/time_parser.rb', line 7
def self.parse(column, first=0, last=59)
base = column + "_#{first}-#{last}"
if CACHE[base]
return CACHE[base]
end
column = column.gsub(%r!/1$!,"").gsub('*', "#{first}-#{last}")
if column.index('/')
times,filter = *column.split("/")
else
times = column
filter = nil
end
result = if times.index(',')
times.split(',').map{|col| separetor(col)}
else
separetor(times)
end.flatten
if filter
result = result.find_all{|n| n % filter.to_i == 0}
end
CACHE[base] = result
end
|