Module: IceCube::Validations::MonthOfYear
- Included in:
- IceCube::ValidatedRule
- 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 |
# 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?(Fixnum) || month.is_a?(Symbol) raise ArgumentError, "expecting Fixnum or Symbol value for month, got #{month.inspect}" end month = TimeUtil.sym_to_month(month) validations_for(:month_of_year) << Validation.new(month) end clobber_base_validations :month self end |