class RiCal::PropertyValue::RecurrenceRule
-
©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
RiCal::PropertyValue::RecurrenceRule represents an icalendar Recurrence Rule property value which is defined in rfc 2445 section 4.3.10 pp 40-45
Attributes
The integer count value of the receiver, or nil
The DATE-TIME value of until limit of the receiver, or nil
Public Instance Methods
Predicate to determine if the receiver generates a bounded or infinite set of occurrences
# File lib/ri_cal/property_value/recurrence_rule.rb, line 149 def bounded? @count || @until end
Set the count parameter of the recurrence rule, the count value will be converted to an integer using to_i
This method resets the receivers list of errors
# File lib/ri_cal/property_value/recurrence_rule.rb, line 97 def count=(count_value) reset_errors @count = count_value @until = nil unless @count.nil? || @by_list_hash end
return the frequency of the rule which will be a string
# File lib/ri_cal/property_value/recurrence_rule.rb, line 68 def freq @freq.upcase end
Set the frequency of the recurrence rule
- freq_value
-
a String which should be in %w[SECONDLY MINUTELY HOURLY DAILY WEEKLY MONTHLY YEARLY]
This method resets the receivers list of errors
# File lib/ri_cal/property_value/recurrence_rule.rb, line 62 def freq=(freq_value) reset_errors @freq = freq_value end
return the INTERVAL parameter of the recurrence rule This returns an Integer
# File lib/ri_cal/property_value/recurrence_rule.rb, line 116 def interval @interval ||= 1 end
Set the INTERVAL parameter of the recurrence rule
- interval_value
-
an Integer
This method resets the receivers list of errors
# File lib/ri_cal/property_value/recurrence_rule.rb, line 125 def interval=(interval_value) reset_errors @interval = interval_value end
Return a string containing the RFC 2445 representation of the recurrence rule
# File lib/ri_cal/property_value/recurrence_rule.rb, line 135 def to_ical result = ["FREQ=#{freq}"] result << "INTERVAL=#{interval}" unless interval == 1 result << "COUNT=#{count}" if count result << "UNTIL=#{self.until.value}" if self.until %w{bysecond byminute byhour byday bymonthday byyearday byweekno bymonth bysetpos}.each do |by_part| val = by_list[by_part.to_sym] result << "#{by_part.upcase}=#{[val].flatten.join(',')}" if val end result << "WKST=#{wkst}" unless wkst == "MO" result.join(";") end
return the starting week day for the recurrence rule, which for a valid instance will be one of “SU”, “MO”, “TU”, “WE”, “TH”, “FR”, or “SA”
# File lib/ri_cal/property_value/recurrence_rule.rb, line 74 def wkst @wkst || 'MO' end
Set the starting week day for the recurrence rule, which should be one of “SU”, “MO”, “TU”, “WE”, “TH”, “FR”, or “SA” for the instance to be valid. The parameter is however case-insensitive.
This method resets the receivers list of errors
# File lib/ri_cal/property_value/recurrence_rule.rb, line 87 def wkst=(value) reset_errors @wkst = value @wkst_day = nil end