class Cronline::Cron
Attributes
days[R]
hours[R]
minutes[R]
months[R]
seconds[R]
years[R]
Public Class Methods
new(cron_expression)
click to toggle source
# File lib/cronline/cron.rb, line 12 def initialize(cron_expression) @seconds = CronSeconds.new(cron_expression) @minutes = CronMinutes.new(cron_expression) @hours = CronHours.new(cron_expression) @months = CronMonths.new(cron_expression) @years = CronYears.new(cron_expression) cron_days_of_month = CronDaysOfMonth.new(cron_expression) cron_days_of_week = CronDaysOfWeek.new(cron_expression) if (cron_days_of_month).active? && (cron_days_of_week).active? fail 'Only one days field is allowed' elsif cron_days_of_week.active? @days = cron_days_of_week elsif cron_days_of_month.active? @days = cron_days_of_month else fail 'One day field is required' end end
Public Instance Methods
test?(time)
click to toggle source
# File lib/cronline/cron.rb, line 33 def test?(time) @years.test?(time) && @months.test?(time) && @days.test?(time) && @hours.test?(time) && @minutes.test?(time) && @seconds.test?(time) end
test_up_to_hours?(time)
click to toggle source
# File lib/cronline/cron.rb, line 38 def test_up_to_hours?(time) @years.test?(time) && @months.test?(time) && @days.test?(time) && @hours.test?(time) end