Class: CronSpec::CronValueBase
- Inherits:
-
Object
- Object
- CronSpec::CronValueBase
- Defined in:
- lib/cron-spec/cron_value_base.rb
Direct Known Subclasses
RangeCronValue, SingleValueCronValue, StepCronValue, WildcardCronValue
Instance Attribute Summary collapse
-
#lower_limit ⇒ Object
readonly
Returns the value of attribute lower_limit.
-
#upper_limit ⇒ Object
readonly
Returns the value of attribute upper_limit.
Instance Method Summary collapse
-
#initialize(lower_limit, upper_limit) ⇒ CronValueBase
constructor
A new instance of CronValueBase.
- #is_value_within_limits?(value) ⇒ Boolean
Constructor Details
#initialize(lower_limit, upper_limit) ⇒ CronValueBase
Returns a new instance of CronValueBase.
7 8 9 10 11 12 |
# File 'lib/cron-spec/cron_value_base.rb', line 7 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 |
Instance Attribute Details
#lower_limit ⇒ Object (readonly)
Returns the value of attribute lower_limit.
5 6 7 |
# File 'lib/cron-spec/cron_value_base.rb', line 5 def lower_limit @lower_limit end |
#upper_limit ⇒ Object (readonly)
Returns the value of attribute upper_limit.
5 6 7 |
# File 'lib/cron-spec/cron_value_base.rb', line 5 def upper_limit @upper_limit end |
Instance Method Details
#is_value_within_limits?(value) ⇒ Boolean
14 15 16 |
# File 'lib/cron-spec/cron_value_base.rb', line 14 def is_value_within_limits?(value) value >= @lower_limit && value <= upper_limit end |