Module: Vpim::Icalendar::Property::Recurrence

Included in:
Vevent, Vjournal, Vtodo
Defined in:
lib/vpim/property/recurrence.rb

Overview

Occurrences are calculated from DTSTART: and RRULE:. If there is not RRULE:, the component recurs only once, at the start time.

Limitations:

Only a single RRULE: is currently supported, this is the most common case.

Implementation of multiple RRULE:s, and RDATE:, EXRULE:, and EXDATE: is on the todo list. Its not a very high priority, because I haven’t seen calendars using the full range of recurrence features, and haven’t received feedback from any users requesting these features. So, if you need it, contact me and implementation will get on the schedule.

Instance Method Summary collapse

Instance Method Details

#occurrencesObject Also known as: occurences

The times this event occurs, as a Vpim::Rrule.



28
29
30
31
32
33
34
# File 'lib/vpim/property/recurrence.rb', line 28

def occurrences
  start = dtstart
  unless start
    raise ArgumentError, "Components with no DTSTART: don't have occurrences!"
  end
  Vpim::Rrule.new(start, propvalue('RRULE'))
end

#occurs_in?(t0, t1) ⇒ Boolean

Check if this event overlaps with the time period later than or equal to t0, but earlier than t1.

Returns:

  • (Boolean)


40
41
42
# File 'lib/vpim/property/recurrence.rb', line 40

def occurs_in?(t0, t1)
  occurrences.each_until(t1).detect { |t| tend = t + (duration || 0); tend > t0 }
end

#rdatesObject



44
45
46
# File 'lib/vpim/property/recurrence.rb', line 44

def rdates
  Vpim.decode_date_time_list(propvalue('RDATE'))
end