Module: IceCube::Validations::DayOfWeek

Included in:
IceCube::ValidatedRule
Defined in:
lib/ice_cube/validations/day_of_week.rb

Defined Under Namespace

Classes: Validation

Instance Method Summary collapse

Instance Method Details

#day_of_week(dows) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/ice_cube/validations/day_of_week.rb', line 5

def day_of_week(dows)
  dows.each do |day, occs|
    occs.each do |occ|
      day = TimeUtil.symbol_to_day(day.to_sym) if day.is_a?(Symbol) or day.is_a?(String)
      validations_for(:day_of_week) << Validation.new(day, occ)
    end
  end
  clobber_base_validations :day, :wday
  self
end