Class: OnCalendar::Condition::DayOfMonth

Inherits:
Base
  • Object
show all
Defined in:
lib/on_calendar/condition/day_of_month.rb

Constant Summary collapse

RANGE =
(1..31)

Instance Attribute Summary

Attributes inherited from Base

#base, #step, #wildcard

Instance Method Summary collapse

Methods inherited from Base

#distance_to_next, #initialize, #match?, range_bounds, #valid?

Constructor Details

This class inherits a constructor from OnCalendar::Condition::Base

Instance Method Details

#range(clamp: nil) ⇒ Object

NOTE: by default we validate number in default range but this needs to be context aware because not all months have the same number of days



10
11
12
13
14
15
16
# File 'lib/on_calendar/condition/day_of_month.rb', line 10

def range(clamp: nil)
  if clamp.present?
    (RANGE.min..Time.days_in_month(clamp.month, clamp.year))
  else
    RANGE
  end
end