Class: CronSpec::RangeCronValue
- Inherits:
-
CronValueBase
- Object
- CronValueBase
- CronSpec::RangeCronValue
- Defined in:
- lib/cron-spec/range_cron_value.rb
Instance Attribute Summary collapse
-
#range_lower ⇒ Object
readonly
Returns the value of attribute range_lower.
-
#range_upper ⇒ Object
readonly
Returns the value of attribute range_upper.
Attributes inherited from CronValueBase
Instance Method Summary collapse
-
#initialize(lower_limit, upper_limit, range_lower, range_upper) ⇒ RangeCronValue
constructor
A new instance of RangeCronValue.
- #is_effective?(value) ⇒ Boolean
Methods inherited from CronValueBase
Constructor Details
#initialize(lower_limit, upper_limit, range_lower, range_upper) ⇒ RangeCronValue
7 8 9 10 11 12 13 14 15 |
# File 'lib/cron-spec/range_cron_value.rb', line 7 def initialize(lower_limit, upper_limit, range_lower, range_upper) super(lower_limit, upper_limit) @range_lower = range_lower @range_upper = range_upper raise "Invalid lower range value: #{@range_lower}" unless is_value_within_limits?(@range_lower) raise "Invalid upper range value: #{@range_upper}" unless is_value_within_limits?(@range_upper) raise "Lower limit must be less than or equal to the upper limit" if @range_lower > @range_upper end |
Instance Attribute Details
#range_lower ⇒ Object (readonly)
Returns the value of attribute range_lower.
5 6 7 |
# File 'lib/cron-spec/range_cron_value.rb', line 5 def range_lower @range_lower end |
#range_upper ⇒ Object (readonly)
Returns the value of attribute range_upper.
5 6 7 |
# File 'lib/cron-spec/range_cron_value.rb', line 5 def range_upper @range_upper end |
Instance Method Details
#is_effective?(value) ⇒ Boolean
17 18 19 |
# File 'lib/cron-spec/range_cron_value.rb', line 17 def is_effective?(value) @range_lower <= value && value <= @range_upper end |