class CronSpec::CronValueBase
Base class for parsed cron values.
Attributes
lower_limit[R]
upper_limit[R]
Public Class Methods
new(lower_limit, upper_limit)
click to toggle source
Constructs a new CronValueBase
with the upper and lower limits of values allowed for this CronValue. For example, when definiting a CronValue for a ‘minute’, the lower limit would be 0 and the upper limit would be 59.
# File lib/cron-spec/cron_value_base.rb, line 16 def initialize(lower_limit, upper_limit) @lower_limit = lower_limit @upper_limit = upper_limit raise "Lower limit must be less than or equal to upper limit" if @lower_limit > @upper_limit end
Public Instance Methods
is_value_within_limits?(value)
click to toggle source
Returns true if the specified value is with the upper and lower limits defined for this CronValue.
# File lib/cron-spec/cron_value_base.rb, line 27 def is_value_within_limits?(value) value >= @lower_limit && value <= upper_limit end