Module RiCal::OccurrenceEnumerator
In: lib/ri_cal/occurrence_enumerator.rb
  • ©2009 Rick DeNatale
  • All rights reserved. Refer to the file README.txt for the license
 OccurrenceEnumerator provides common methods for CalendarComponents that support recurrence
 i.e. Event, Journal, Todo, and TimezonePeriod

Methods

Included Modules

Enumerable

Public Instance methods

A predicate which determines whether the component has a bounded set of occurrences

execute the block for each occurrence

return an array of occurrences according to the options parameter. If a component is not bounded, and the number of occurrences to be returned is not constrained by either the :before, or :count options an ArgumentError will be raised.

The components returned will be the same type as the receiver, but will have any recurrence properties (rrule, rdate, exrule, exdate) removed since they are single occurrences, and will have the recurrence-id property set to the occurrences dtstart value. (see RFC 2445 sec 4.8.4.4 pp 107-109)

parameter options:

  • :starting:: a Date, Time, or DateTime, no occurrences starting before this argument will be returned
  • :before:: a Date, Time, or DateTime, no occurrences starting on or after this argument will be returned.
  • :count:: an integer which limits the number of occurrences returned.
  • :overlapping:: a two element array of Dates, Times, or DateTimes, assumed to be in chronological order. Only occurrences which are either totally or partially within the range will be returned.

Return a array whose first element is a UTC DateTime representing the start of the first occurrence, and whose second element is a UTC DateTime representing the end of the last occurrence. If the receiver is not bounded then the second element will be nil.

The purpose of this method is to provide values which may be used as database attributes so that a query can find all occurence enumerating components which may have occurrences within a range of times.

[Validate]