Module: Vpim::Icalendar::Property::Recurrence
Overview
Occurrences are calculated from DTSTART and RRULE. If there is no RRULE, the component occurs only once, at the start time.
Limitations:
Only a single RRULE: is currently supported, this is the most common case.
Instance Method Summary collapse
-
#occurrences(dountil = nil, &block) ⇒ Object
(also: #occurences)
The times this components occurs.
-
#occurs_in?(t0, t1) ⇒ Boolean
True if this components occurs in a time period later than
t0
, but earlier thant1
. -
#rdates ⇒ Object
:nodoc:.
-
#rrule ⇒ Object
:nodoc:.
Instance Method Details
#occurrences(dountil = nil, &block) ⇒ Object Also known as: occurences
The times this components occurs. If a block is not provided, returns an enumerator.
Occurrences may be infinite, dountil
can be provided to limit the iterations, see Rrule#each.
37 38 39 40 41 42 43 44 |
# File 'lib/vpim/property/recurrence.rb', line 37 def occurrences(dountil = nil, &block) #:yield: occurrence time rr = rrule unless block_given? return Enumerable::Enumerator.new(self, :occurrences, dountil) end rr.each(dountil, &block) end |
#occurs_in?(t0, t1) ⇒ Boolean
True if this components occurs in a time period later than t0
, but earlier than t1
.
50 51 52 53 54 55 56 57 58 |
# File 'lib/vpim/property/recurrence.rb', line 50 def occurs_in?(t0, t1) # TODO - deprecate this, its a hack occurrences(t1).detect do |tend| if respond_to? :duration tend += duration || 0 end tend >= t0 end end |
#rdates ⇒ Object
:nodoc:
60 61 62 63 |
# File 'lib/vpim/property/recurrence.rb', line 60 def rdates #:nodoc: # TODO - this is a hack, remove it Vpim.decode_date_time_list(propvalue('RDATE')) end |