Module: Hookit::Helper::Cron

Defined in:
lib/hookit/helper/cron.rb

Constant Summary collapse

MINUTES =
59
HOURS =
23
DAYS =
31
MONTHS =
12
WEEKDAY =
7

Instance Method Summary collapse

Instance Method Details

#sanitize_cron(cron) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# 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