Module: IceCube::Validations::MonthOfYear

Included in:
DailyRule, HourlyRule, MinutelyRule, MonthlyRule, SecondlyRule, WeeklyRule, YearlyRule
Defined in:
lib/ice_cube/validations/month_of_year.rb

Defined Under Namespace

Classes: Validation

Instance Method Summary collapse

Instance Method Details

#month_of_year(*months) ⇒ Object


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

def month_of_year(*months)
  months.flatten.each do |month|
    unless month.is_a?(Integer) || month.is_a?(Symbol)
      raise ArgumentError, "expecting Integer or Symbol value for month, got #{month.inspect}"
    end
    month = TimeUtil.sym_to_month(month)
    verify_alignment(month, :month, :month_of_year) { |error| raise error }
    validations_for(:month_of_year) << Validation.new(month)
  end
  clobber_base_validations :month
  self
end