Class: CronSpec::CronValueBase

Inherits:
Object
  • Object
show all
Defined in:
lib/cron-spec/cron_value_base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_limitObject (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_limitObject (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

Returns:

  • (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