Class: Bizside::CronValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/bizside/cron_validator.rb

Constant Summary collapse

MIN_MINUTE =
0
MAX_MINUTE =
59
MIN_HOUR =
0
MAX_HOUR =
23
MIN_DAY =
1
MAX_DAY =
31
MIN_MONTH =
1
MAX_MONTH =
12
MIN_WEEKDAY =
0
MAX_WEEKDAY =
7
CRON_ATTR =
%w(minute hour day month weekday)

Instance Method Summary collapse

Constructor Details

#initialize(cron) ⇒ CronValidator

Returns a new instance of CronValidator.



15
16
17
# File 'lib/bizside/cron_validator.rb', line 15

def initialize(cron)
  @minute, @hour, @day, @month, @weekday = cron.split
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
# File 'lib/bizside/cron_validator.rb', line 19

def valid?
  valid_minute? &&
  valid_hour? &&
  valid_day? &&
  valid_month? &&
  valid_weekday?
end