Class: RiCal::PropertyValue::RecurrenceRule
- Inherits:
-
RiCal::PropertyValue
- Object
- RiCal::PropertyValue
- RiCal::PropertyValue::RecurrenceRule
- Defined in:
- lib/ri_cal/property_value/recurrence_rule.rb,
lib/ri_cal/property_value/recurrence_rule/enumerator.rb,
lib/ri_cal/property_value/recurrence_rule/validations.rb,
lib/ri_cal/property_value/recurrence_rule/numbered_span.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_day.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb,
lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb,
lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb,
lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb
Overview
-
©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
Defined Under Namespace
Modules: EnumerationSupportMethods, InitializationMethods, TimeManipulation, Validations Classes: ByDayIncrementer, ByHourIncrementer, ByMinuteIncrementer, ByMonthIncrementer, ByMonthdayIncrementer, ByNumberedDayIncrementer, BySecondIncrementer, ByWeekNoIncrementer, ByYeardayIncrementer, DailyIncrementer, Enumerator, FrequencyIncrementer, HourlyIncrementer, ListIncrementer, MinutelyIncrementer, MonthlyIncrementer, NegativeSetposEnumerator, NumberedSpan, OccurrenceIncrementer, RecurringDay, RecurringMonthDay, RecurringNumberedWeek, RecurringYearDay, SecondlyIncrementer, WeeklyIncrementer, YearlyIncrementer
Instance Attribute Summary collapse
-
#count ⇒ Object
The integer count value of the receiver, or nil.
-
#until ⇒ Object
The DATE-TIME value of until limit of the receiver, or nil.
Attributes included from InitializationMethods
Attributes inherited from RiCal::PropertyValue
Class Method Summary collapse
-
.convert(parent, value) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#bounded? ⇒ Boolean
Predicate to determine if the receiver generates a bounded or infinite set of occurrences.
-
#freq ⇒ Object
return the frequency of the rule which will be a string.
-
#freq=(freq_value) ⇒ Object
- Set the frequency of the recurrence rule freq_value
-
a String which should be in %w[SECONDLY MINUTELY HOURLY DAILY WEEKLY MONTHLY YEARLY].
-
#initialize(parent, value_hash) ⇒ RecurrenceRule
constructor
:nodoc:.
-
#interval ⇒ Object
return the INTERVAL parameter of the recurrence rule This returns an Integer.
-
#interval=(interval_value) ⇒ Object
Set the INTERVAL parameter of the recurrence rule.
-
#to_ical ⇒ Object
Return a string containing the RFC 2445 representation of the recurrence rule.
-
#value ⇒ Object
:nodoc:.
-
#value=(string) ⇒ Object
:nodoc:.
-
#wkst ⇒ Object
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”.
-
#wkst=(value) ⇒ Object
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.
-
#wkst_day ⇒ Object
:nodoc:.
Methods included from EnumerationSupportMethods
#adjust_start, #by_rule_list, #enumerator, #exhausted?, #in_same_set?
Methods included from InitializationMethods
#add_byrule_strings_to_options_hash, #add_to_options_hash, #by_list, #byday=, #byhour=, #byminute=, #bymonth=, #bymonthday=, #bysecond=, #bysetpos=, #byweekno=, #byyearday=, #calc_by_day_scope, #init_by_lists, #initialize_from_value_part, #to_options_hash
Methods included from Validations
#errors, #reset_errors, #valid?, #validate, #validate_byday_list, #validate_bymonthday_list, #validate_bysetpos, #validate_byweekno_list, #validate_byyearday_list, #validate_freq, #validate_int_by_list, #validate_interval, #validate_termination, #validate_wkst
Methods inherited from RiCal::PropertyValue
#==, #add_date_times_to, date_or_date_time, date_or_date_time_or_period, #default_tzid, #enumerator, #equality_value, #find_timezone, #for_parent, if_valid_string, #parms_string, #ruby_value, #to_options_hash, #to_ri_cal_property_value, #to_s, #tz_info_source?, #validate_value, #visible_params
Constructor Details
#initialize(parent, value_hash) ⇒ RecurrenceRule
:nodoc:
14 15 16 17 18 19 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 14 def initialize(parent, value_hash) # :nodoc: @by_list_hash = {} super init_by_lists @by_list_hash = nil end |
Instance Attribute Details
#count ⇒ Object
The integer count value of the receiver, or nil
35 36 37 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 35 def count @count end |
#until ⇒ Object
The DATE-TIME value of until limit of the receiver, or nil
37 38 39 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 37 def until @until end |
Class Method Details
Instance Method Details
#bounded? ⇒ Boolean
Predicate to determine if the receiver generates a bounded or infinite set of occurrences
140 141 142 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 140 def bounded? @count || @until end |
#freq ⇒ Object
return the frequency of the rule which will be a string
59 60 61 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 59 def freq @freq.upcase end |
#freq=(freq_value) ⇒ Object
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
53 54 55 56 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 53 def freq=(freq_value) reset_errors @freq = freq_value end |
#interval ⇒ Object
return the INTERVAL parameter of the recurrence rule This returns an Integer
107 108 109 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 107 def interval @interval ||= 1 end |
#interval=(interval_value) ⇒ Object
Set the INTERVAL parameter of the recurrence rule
- interval_value
-
an Integer
This method resets the receivers list of errors
116 117 118 119 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 116 def interval=(interval_value) reset_errors @interval = interval_value end |
#to_ical ⇒ Object
Return a string containing the RFC 2445 representation of the recurrence rule
126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 126 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 |
#value ⇒ Object
:nodoc:
121 122 123 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 121 def value #:nodoc: @value || to_ical end |
#value=(string) ⇒ Object
:nodoc:
39 40 41 42 43 44 45 46 47 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 39 def value=(string) # :nodoc: if string @value = string dup_hash = {} string.split(";").each do |value_part| initialize_from_value_part(value_part, dup_hash) end end end |
#wkst ⇒ Object
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”
65 66 67 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 65 def wkst @wkst || 'MO' end |
#wkst=(value) ⇒ Object
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
78 79 80 81 82 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 78 def wkst=(value) reset_errors @wkst = value @wkst_day = nil end |
#wkst_day ⇒ Object
:nodoc:
69 70 71 |
# File 'lib/ri_cal/property_value/recurrence_rule.rb', line 69 def wkst_day # :nodoc: @wkst_day ||= (%w{SU MO TU WE FR SA}.index(wkst) || 1) end |