module Hookit::Helper::Cron
Constants
- DAYS
- HOURS
- MINUTES
- MONTHS
- WEEKDAY
Public Instance Methods
sanitize_cron(cron)
click to toggle source
# File lib/hookit/helper/cron.rb, line 11 def sanitize_cron(cron) time = cron.split(' ') time[0] = compatible_cron(time[0],MINUTES) time[1] = compatible_cron(time[1],HOURS) time[2] = compatible_cron(time[2],DAYS, 1) time[3] = compatible_cron(time[3],MONTHS, 1) time[4] = compatible_cron(time[4],WEEKDAY) time.join(' ') end
Protected Instance Methods
compatible_cron(time, limit, start = 0)
click to toggle source
converts */x cron format into solaris compatible format
# File lib/hookit/helper/cron.rb, line 27 def compatible_cron(time, limit, start = 0) if time =~ /\// increment = time.split('/')[1].to_i x, y = start, [] for i in 0..limit/increment y[i] = x x +=increment end time = y.join(',') end time end