Class: RiCal::PropertyValue::RecurrenceRule::OccurrenceIncrementer::ByNumberedDayIncrementer
- Inherits:
-
ListIncrementer
- Object
- RiCal::PropertyValue::RecurrenceRule::OccurrenceIncrementer
- ListIncrementer
- RiCal::PropertyValue::RecurrenceRule::OccurrenceIncrementer::ByNumberedDayIncrementer
- Defined in:
- lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from ListIncrementer
#cycle_start, #list, #occurrences, #outer_occurrence
Attributes inherited from RiCal::PropertyValue::RecurrenceRule::OccurrenceIncrementer
#contains_daily_incrementer, #contains_weeknum_incrementer, #current_occurrence, #leaf_iterator, #outer_incrementers, #outer_range, #sub_cycle_incrementer
Instance Method Summary collapse
- #candidate_acceptable?(candidate) ⇒ Boolean
- #daily_incrementer? ⇒ Boolean
- #end_of_occurrence(date_time) ⇒ Object
- #occurrences_for(date_time) ⇒ Object
- #unneeded?(candidate) ⇒ Boolean
Methods inherited from ListIncrementer
conditional_incrementer, #cycle_adjust, #first_within_outer_cycle, #get_next_occurrences, #initialize, #next_candidate, #next_cycle, #next_in_list, #occurrences_within
Methods inherited from RiCal::PropertyValue::RecurrenceRule::OccurrenceIncrementer
#add_outer_incrementer, #contains_daily_incrementer?, #contains_weeknum_incrementer?, #first_sub_occurrence, from_rrule, #in_outer_cycle?, #initialize, #next_cycle, #next_time, #outermost?, #short_name, #to_s, #update_cycle_range, #weeknum_incrementer?
Methods included from TimeManipulation
#advance_day, #advance_month, #advance_week, #advance_year, #first_day_of_month, #first_day_of_week, #first_day_of_year, #first_hour_of_day
Constructor Details
This class inherits a constructor from RiCal::PropertyValue::RecurrenceRule::OccurrenceIncrementer::ListIncrementer
Instance Method Details
#candidate_acceptable?(candidate) ⇒ Boolean
29 30 31 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb', line 29 def candidate_acceptable?(candidate) list.any? {|by_part| by_part.include?(candidate)} end |
#daily_incrementer? ⇒ Boolean
7 8 9 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb', line 7 def daily_incrementer? true end |
#end_of_occurrence(date_time) ⇒ Object
25 26 27 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb', line 25 def end_of_occurrence(date_time) date_time.end_of_day end |
#occurrences_for(date_time) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb', line 15 def occurrences_for(date_time) if occurrences && @scoping_value == scope_of(date_time) occurrences else @scoping_value = scope_of(date_time) self.occurrences = list.map {|numbered_day| numbered_day.target_date_time_for(date_time)}.uniq.sort occurrences end end |
#unneeded?(candidate) ⇒ Boolean
11 12 13 |
# File 'lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb', line 11 def unneeded?(candidate) list.length == 1 && list.first.fixed_day? end |