Module: IceCube::Validations::DayOfYear

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

Defined Under Namespace

Classes: Validation

Instance Method Summary collapse

Instance Method Details

#day_of_year(*days) ⇒ Object



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

def day_of_year(*days)
  days.flatten.each do |day|
    unless day.is_a?(Fixnum)
      raise ArgumentError, "expecting Fixnum value for day, got #{day.inspect}"
    end
    validations_for(:day_of_year) << Validation.new(day)
  end
  clobber_base_validations(:month, :day, :wday)
  self
end