Module: IceCube::Validations::Lock

Defined in:
lib/ice_cube/validations/lock.rb

Overview

This validation mixin is used by the various “fixed-time” (e.g. day, day_of_month, hour_of_day) Validation and ScheduleLock::Validation modules. It is not a standalone rule validation like the others.

Given the including Validation’s defined type field, it will lock to the specified value or else the corresponding time unit from the schedule’s start_time

Constant Summary collapse

INTERVALS =
{:min => 60, :sec => 60, :hour => 24, :month => 12, :wday => 7}

Instance Method Summary collapse

Instance Method Details

#validate(time, start_time) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/ice_cube/validations/lock.rb', line 15

def validate(time, start_time)
  case type
  when :day  then validate_day_lock(time, start_time)
  when :hour then validate_hour_lock(time, start_time)
  else validate_interval_lock(time, start_time)
  end
end