module IceCube::Validations::MonthOfYear

Public Instance Methods

month_of_year(*months) click to toggle source
# 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