Class: CronSpec::StepCronValue
- Inherits:
-
CronValueBase
- Object
- CronValueBase
- CronSpec::StepCronValue
- Defined in:
- lib/cron-spec/step_cron_value.rb
Instance Attribute Summary collapse
-
#step_value ⇒ Object
readonly
Returns the value of attribute step_value.
Attributes inherited from CronValueBase
Instance Method Summary collapse
-
#initialize(lower_limit, upper_limit, step_value) ⇒ StepCronValue
constructor
A new instance of StepCronValue.
- #is_effective?(value) ⇒ Boolean
Methods inherited from CronValueBase
Constructor Details
#initialize(lower_limit, upper_limit, step_value) ⇒ StepCronValue
Returns a new instance of StepCronValue.
7 8 9 10 11 12 13 |
# File 'lib/cron-spec/step_cron_value.rb', line 7 def initialize(lower_limit, upper_limit, step_value) super(lower_limit, upper_limit) @step_value = step_value raise "Invalid step value: #{@step_value}" if step_value == 0 || step_value > upper_limit end |
Instance Attribute Details
#step_value ⇒ Object (readonly)
Returns the value of attribute step_value.
5 6 7 |
# File 'lib/cron-spec/step_cron_value.rb', line 5 def step_value @step_value end |
Instance Method Details
#is_effective?(value) ⇒ Boolean
15 16 17 |
# File 'lib/cron-spec/step_cron_value.rb', line 15 def is_effective?(value) value % @step_value == 0 end |