Class: RiCal::PropertyValue::RecurrenceRule::RecurringMonthDay
- Inherits:
-
NumberedSpan
- Object
- NumberedSpan
- RiCal::PropertyValue::RecurrenceRule::RecurringMonthDay
- Defined in:
- lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
Overview
-
©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
Instances of RecurringMonthDay represent BYMONTHDAY parts in recurrence rules
Instance Attribute Summary
Attributes inherited from NumberedSpan
Instance Method Summary collapse
- #include?(date_or_time) ⇒ Boolean
-
#last ⇒ Object
:nodoc:.
-
#list_id(time) ⇒ Object
return a list id for a given time to allow the enumerator to cache lists.
-
#matches_for(time) ⇒ Object
return a list of times which match the time parameter within the scope of the RecurringDay.
- #target_date_time_for(date_time) ⇒ Object
- #target_for(date_or_time) ⇒ Object
Methods inherited from NumberedSpan
#==, #initialize, #ordinal, #to_s, #valid?
Constructor Details
This class inherits a constructor from RiCal::PropertyValue::RecurrenceRule::NumberedSpan
Instance Method Details
#include?(date_or_time) ⇒ Boolean
54 55 56 |
# File 'lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb', line 54 def include?(date_or_time) date_or_time.mday == target_for(date_or_time) end |
#last ⇒ Object
:nodoc:
9 10 11 |
# File 'lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb', line 9 def last 31 end |
#list_id(time) ⇒ Object
return a list id for a given time to allow the enumerator to cache lists
14 15 16 |
# File 'lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb', line 14 def list_id(time) time.month end |
#matches_for(time) ⇒ Object
return a list of times which match the time parameter within the scope of the RecurringDay
19 20 21 |
# File 'lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb', line 19 def matches_for(time) [time.change(:day => 1).advance(:days => target_for(time)- 1)] end |
#target_date_time_for(date_time) ⇒ Object
33 34 35 |
# File 'lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb', line 33 def target_date_time_for(date_time) matches_for(date_time)[0] end |
#target_for(date_or_time) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb', line 46 def target_for(date_or_time) if @source > 0 @source else date_or_time.days_in_month + @source + 1 end end |