ri_cal 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. data/History.txt +45 -0
  2. data/Manifest.txt +129 -0
  3. data/README.txt +394 -0
  4. data/Rakefile +31 -0
  5. data/bin/ri_cal +8 -0
  6. data/component_attributes/alarm.yml +10 -0
  7. data/component_attributes/calendar.yml +4 -0
  8. data/component_attributes/component_property_defs.yml +180 -0
  9. data/component_attributes/event.yml +45 -0
  10. data/component_attributes/freebusy.yml +16 -0
  11. data/component_attributes/journal.yml +35 -0
  12. data/component_attributes/timezone.yml +3 -0
  13. data/component_attributes/timezone_period.yml +11 -0
  14. data/component_attributes/todo.yml +46 -0
  15. data/copyrights.txt +1 -0
  16. data/docs/draft-ietf-calsify-2446bis-08.txt +7280 -0
  17. data/docs/draft-ietf-calsify-rfc2445bis-09.txt +10416 -0
  18. data/docs/incrementers.txt +7 -0
  19. data/docs/rfc2445.pdf +0 -0
  20. data/lib/ri_cal.rb +144 -0
  21. data/lib/ri_cal/component.rb +247 -0
  22. data/lib/ri_cal/component/alarm.rb +21 -0
  23. data/lib/ri_cal/component/calendar.rb +219 -0
  24. data/lib/ri_cal/component/event.rb +60 -0
  25. data/lib/ri_cal/component/freebusy.rb +18 -0
  26. data/lib/ri_cal/component/journal.rb +30 -0
  27. data/lib/ri_cal/component/t_z_info_timezone.rb +123 -0
  28. data/lib/ri_cal/component/timezone.rb +196 -0
  29. data/lib/ri_cal/component/timezone/daylight_period.rb +25 -0
  30. data/lib/ri_cal/component/timezone/standard_period.rb +23 -0
  31. data/lib/ri_cal/component/timezone/timezone_period.rb +53 -0
  32. data/lib/ri_cal/component/todo.rb +43 -0
  33. data/lib/ri_cal/core_extensions.rb +6 -0
  34. data/lib/ri_cal/core_extensions/array.rb +7 -0
  35. data/lib/ri_cal/core_extensions/array/conversions.rb +15 -0
  36. data/lib/ri_cal/core_extensions/date.rb +13 -0
  37. data/lib/ri_cal/core_extensions/date/conversions.rb +61 -0
  38. data/lib/ri_cal/core_extensions/date_time.rb +15 -0
  39. data/lib/ri_cal/core_extensions/date_time/conversions.rb +50 -0
  40. data/lib/ri_cal/core_extensions/object.rb +8 -0
  41. data/lib/ri_cal/core_extensions/object/conversions.rb +20 -0
  42. data/lib/ri_cal/core_extensions/string.rb +8 -0
  43. data/lib/ri_cal/core_extensions/string/conversions.rb +63 -0
  44. data/lib/ri_cal/core_extensions/time.rb +13 -0
  45. data/lib/ri_cal/core_extensions/time/calculations.rb +153 -0
  46. data/lib/ri_cal/core_extensions/time/conversions.rb +61 -0
  47. data/lib/ri_cal/core_extensions/time/tzid_access.rb +50 -0
  48. data/lib/ri_cal/core_extensions/time/week_day_predicates.rb +88 -0
  49. data/lib/ri_cal/floating_timezone.rb +32 -0
  50. data/lib/ri_cal/invalid_property_value.rb +8 -0
  51. data/lib/ri_cal/invalid_timezone_identifer.rb +20 -0
  52. data/lib/ri_cal/occurrence_enumerator.rb +206 -0
  53. data/lib/ri_cal/occurrence_period.rb +17 -0
  54. data/lib/ri_cal/parser.rb +138 -0
  55. data/lib/ri_cal/properties/alarm.rb +390 -0
  56. data/lib/ri_cal/properties/calendar.rb +164 -0
  57. data/lib/ri_cal/properties/event.rb +1526 -0
  58. data/lib/ri_cal/properties/freebusy.rb +594 -0
  59. data/lib/ri_cal/properties/journal.rb +1240 -0
  60. data/lib/ri_cal/properties/timezone.rb +151 -0
  61. data/lib/ri_cal/properties/timezone_period.rb +416 -0
  62. data/lib/ri_cal/properties/todo.rb +1562 -0
  63. data/lib/ri_cal/property_value.rb +149 -0
  64. data/lib/ri_cal/property_value/array.rb +27 -0
  65. data/lib/ri_cal/property_value/cal_address.rb +11 -0
  66. data/lib/ri_cal/property_value/date.rb +175 -0
  67. data/lib/ri_cal/property_value/date_time.rb +335 -0
  68. data/lib/ri_cal/property_value/date_time/additive_methods.rb +44 -0
  69. data/lib/ri_cal/property_value/date_time/time_machine.rb +181 -0
  70. data/lib/ri_cal/property_value/date_time/timezone_support.rb +96 -0
  71. data/lib/ri_cal/property_value/duration.rb +110 -0
  72. data/lib/ri_cal/property_value/geo.rb +11 -0
  73. data/lib/ri_cal/property_value/integer.rb +12 -0
  74. data/lib/ri_cal/property_value/occurrence_list.rb +144 -0
  75. data/lib/ri_cal/property_value/period.rb +82 -0
  76. data/lib/ri_cal/property_value/recurrence_rule.rb +145 -0
  77. data/lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb +97 -0
  78. data/lib/ri_cal/property_value/recurrence_rule/enumerator.rb +79 -0
  79. data/lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb +148 -0
  80. data/lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb +53 -0
  81. data/lib/ri_cal/property_value/recurrence_rule/numbered_span.rb +31 -0
  82. data/lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb +793 -0
  83. data/lib/ri_cal/property_value/recurrence_rule/recurring_day.rb +131 -0
  84. data/lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb +60 -0
  85. data/lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb +33 -0
  86. data/lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb +49 -0
  87. data/lib/ri_cal/property_value/recurrence_rule/validations.rb +125 -0
  88. data/lib/ri_cal/property_value/text.rb +40 -0
  89. data/lib/ri_cal/property_value/uri.rb +11 -0
  90. data/lib/ri_cal/property_value/utc_offset.rb +33 -0
  91. data/lib/ri_cal/required_timezones.rb +55 -0
  92. data/ri_cal.gemspec +49 -0
  93. data/sample_ical_files/from_ical_dot_app/test1.ics +38 -0
  94. data/script/console +10 -0
  95. data/script/destroy +14 -0
  96. data/script/generate +14 -0
  97. data/script/txt2html +71 -0
  98. data/spec/ri_cal/component/alarm_spec.rb +12 -0
  99. data/spec/ri_cal/component/calendar_spec.rb +54 -0
  100. data/spec/ri_cal/component/event_spec.rb +601 -0
  101. data/spec/ri_cal/component/freebusy_spec.rb +12 -0
  102. data/spec/ri_cal/component/journal_spec.rb +37 -0
  103. data/spec/ri_cal/component/t_z_info_timezone_spec.rb +36 -0
  104. data/spec/ri_cal/component/timezone_spec.rb +218 -0
  105. data/spec/ri_cal/component/todo_spec.rb +112 -0
  106. data/spec/ri_cal/component_spec.rb +224 -0
  107. data/spec/ri_cal/core_extensions/string/conversions_spec.rb +78 -0
  108. data/spec/ri_cal/core_extensions/time/calculations_spec.rb +188 -0
  109. data/spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb +45 -0
  110. data/spec/ri_cal/occurrence_enumerator_spec.rb +573 -0
  111. data/spec/ri_cal/parser_spec.rb +303 -0
  112. data/spec/ri_cal/property_value/date_spec.rb +53 -0
  113. data/spec/ri_cal/property_value/date_time_spec.rb +383 -0
  114. data/spec/ri_cal/property_value/duration_spec.rb +126 -0
  115. data/spec/ri_cal/property_value/occurrence_list_spec.rb +72 -0
  116. data/spec/ri_cal/property_value/period_spec.rb +49 -0
  117. data/spec/ri_cal/property_value/recurrence_rule/recurring_year_day_spec.rb +21 -0
  118. data/spec/ri_cal/property_value/recurrence_rule_spec.rb +1814 -0
  119. data/spec/ri_cal/property_value/text_spec.rb +25 -0
  120. data/spec/ri_cal/property_value/utc_offset_spec.rb +48 -0
  121. data/spec/ri_cal/property_value_spec.rb +125 -0
  122. data/spec/ri_cal/required_timezones_spec.rb +67 -0
  123. data/spec/ri_cal_spec.rb +53 -0
  124. data/spec/spec.opts +4 -0
  125. data/spec/spec_helper.rb +46 -0
  126. data/tasks/gem_loader/load_active_support.rb +3 -0
  127. data/tasks/gem_loader/load_tzinfo_gem.rb +2 -0
  128. data/tasks/ri_cal.rake +410 -0
  129. data/tasks/spec.rake +50 -0
  130. metadata +221 -0
@@ -0,0 +1,151 @@
1
+ module RiCal
2
+ module Properties #:nodoc:
3
+ #- ©2009 Rick DeNatale
4
+ #- All rights reserved. Refer to the file README.txt for the license
5
+ #
6
+ # Properties::Timezone provides property accessing methods for the Timezone class
7
+ # This source file is generated by the rical:gen_propmodules rake tasks, DO NOT EDIT
8
+ module Timezone
9
+
10
+ # return the the TZID property
11
+ # which will be an instances of RiCal::PropertyValueText
12
+ #
13
+ # [purpose (from RFC 2445)]
14
+ # This property specifies the text value that uniquely indentifies the "VTIMEZONE" calendar component.
15
+ #
16
+ # see RFC 2445 4.8.3.1 pp 97-98
17
+ def tzid_property
18
+ @tzid_property
19
+ end
20
+
21
+ # set the TZID property
22
+ # property value should be an instance of RiCal::PropertyValueText
23
+ def tzid_property=(property_value)
24
+ @tzid_property = property_value
25
+ end
26
+
27
+ # set the value of the TZID property
28
+ def tzid=(ruby_value)
29
+ self.tzid_property= RiCal::PropertyValue::Text.convert(self, ruby_value)
30
+ end
31
+
32
+ # return the value of the TZID property
33
+ # which will be an instance of String
34
+ def tzid
35
+ tzid_property ? tzid_property.ruby_value : nil
36
+ end
37
+
38
+ def tzid_property_from_string(line) # :nodoc:
39
+ @tzid_property = RiCal::PropertyValue::Text.new(self, line)
40
+ end
41
+
42
+
43
+ # return the the LAST-MODIFIED property
44
+ # which will be an instances of RiCal::PropertyValueDateTime
45
+ #
46
+ # [purpose (from RFC 2445)]
47
+ # This property specifies the date and time that the information associated with the calendar component was last revised in teh calendar store.
48
+ #
49
+ # see RFC 2445 4.8.7.3 p 131
50
+ def last_modified_property
51
+ @last_modified_property
52
+ end
53
+
54
+ # set the LAST-MODIFIED property
55
+ # property value should be an instance of RiCal::PropertyValueDateTime
56
+ def last_modified_property=(property_value)
57
+ @last_modified_property = property_value ? property_value.for_parent(self) : nil
58
+ end
59
+
60
+ # set the value of the LAST-MODIFIED property
61
+ def last_modified=(ruby_value)
62
+ self.last_modified_property= RiCal::PropertyValue::DateTime.convert(self, ruby_value)
63
+ end
64
+
65
+ # return the value of the LAST-MODIFIED property
66
+ # which will be an instance of DateTime
67
+ def last_modified
68
+ last_modified_property ? last_modified_property.ruby_value : nil
69
+ end
70
+
71
+ def last_modified_property_from_string(line) # :nodoc:
72
+ @last_modified_property = RiCal::PropertyValue::DateTime.new(self, line)
73
+ end
74
+
75
+
76
+ # return the the TZURL property
77
+ # which will be an instances of RiCal::PropertyValueUri
78
+ #
79
+ # [purpose (from RFC 2445)]
80
+ # The TZURL provies a means for a VTIMEZONE component to point to a network location that can be used to retrieve an up-to_date version of itself.
81
+ #
82
+ # see RFC 2445 4.8.3.4 p 101
83
+ def tzurl_property
84
+ @tzurl_property
85
+ end
86
+
87
+ # set the TZURL property
88
+ # property value should be an instance of RiCal::PropertyValueUri
89
+ def tzurl_property=(property_value)
90
+ @tzurl_property = property_value
91
+ end
92
+
93
+ # set the value of the TZURL property
94
+ def tzurl=(ruby_value)
95
+ self.tzurl_property= RiCal::PropertyValue::Uri.convert(self, ruby_value)
96
+ end
97
+
98
+ # return the value of the TZURL property
99
+ # which will be an instance of Uri
100
+ def tzurl
101
+ tzurl_property ? tzurl_property.ruby_value : nil
102
+ end
103
+
104
+ def tzurl_property_from_string(line) # :nodoc:
105
+ @tzurl_property = RiCal::PropertyValue::Uri.new(self, line)
106
+ end
107
+
108
+
109
+ def export_properties_to(export_stream) #:nodoc:
110
+ export_prop_to(export_stream, "LAST-MODIFIED", @last_modified_property)
111
+ export_prop_to(export_stream, "TZURL", @tzurl_property)
112
+ export_prop_to(export_stream, "TZID", @tzid_property)
113
+ end
114
+
115
+ def ==(o) #:nodoc:
116
+ if o.class == self.class
117
+ (last_modified_property == o.last_modified_property) &&
118
+ (tzurl_property == o.tzurl_property) &&
119
+ (tzid_property == o.tzid_property)
120
+ else
121
+ super
122
+ end
123
+ end
124
+
125
+ def initialize_copy(o) #:nodoc:
126
+ super
127
+ last_modified_property = last_modified_property && last_modified_property.dup
128
+ tzurl_property = tzurl_property && tzurl_property.dup
129
+ tzid_property = tzid_property && tzid_property.dup
130
+ end
131
+
132
+ def add_date_times_to(required_timezones) #:nodoc:
133
+ add_property_date_times_to(required_timezones, last_modified_property)
134
+ end
135
+
136
+ module ClassMethods #:nodoc:
137
+ def property_parser #:nodoc:
138
+ {"TZID"=>:tzid_property_from_string, "TZURL"=>:tzurl_property_from_string, "LAST-MODIFIED"=>:last_modified_property_from_string}
139
+ end
140
+ end
141
+
142
+ def self.included(mod) #:nodoc:
143
+ mod.extend ClassMethods
144
+ end
145
+
146
+ def mutual_exclusion_violation #:nodoc:
147
+ false
148
+ end
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,416 @@
1
+ module RiCal
2
+ module Properties #:nodoc:
3
+ #- ©2009 Rick DeNatale
4
+ #- All rights reserved. Refer to the file README.txt for the license
5
+ #
6
+ # Properties::TimezonePeriod provides property accessing methods for the TimezonePeriod class
7
+ # This source file is generated by the rical:gen_propmodules rake tasks, DO NOT EDIT
8
+ module TimezonePeriod
9
+
10
+ # return the the DTSTART property
11
+ # which will be an instances of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
12
+ #
13
+ # [purpose (from RFC 2445)]
14
+ # This property specifies when the calendar component begins.
15
+ #
16
+ # see RFC 2445 4.8.2.4 pp 93-94
17
+ def dtstart_property
18
+ @dtstart_property
19
+ end
20
+
21
+ # set the DTSTART property
22
+ # property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
23
+ def dtstart_property=(property_value)
24
+ @dtstart_property = property_value ? property_value.for_parent(self) : nil
25
+ end
26
+
27
+ # set the value of the DTSTART property
28
+ def dtstart=(ruby_value)
29
+ self.dtstart_property= RiCal::PropertyValue::DateTime.convert(self, ruby_value)
30
+ end
31
+
32
+ # return the value of the DTSTART property
33
+ # which will be an instance of either DateTime or Date
34
+ def dtstart
35
+ dtstart_property ? dtstart_property.ruby_value : nil
36
+ end
37
+
38
+ def dtstart_property_from_string(line) # :nodoc:
39
+ @dtstart_property = RiCal::PropertyValue::DateTime.or_date(self, line)
40
+ end
41
+
42
+
43
+ # return the the TZOFFSETTO property
44
+ # which will be an instances of RiCal::PropertyValueUtcOffset
45
+ #
46
+ # [purpose (from RFC 2445)]
47
+ # This property specifies the offset which is in use in this time zone observance
48
+ #
49
+ # see RFC 2445 4.8.3.4 pp 100-101
50
+ def tzoffsetto_property
51
+ @tzoffsetto_property
52
+ end
53
+
54
+ # set the TZOFFSETTO property
55
+ # property value should be an instance of RiCal::PropertyValueUtcOffset
56
+ def tzoffsetto_property=(property_value)
57
+ @tzoffsetto_property = property_value
58
+ end
59
+
60
+ # set the value of the TZOFFSETTO property
61
+ def tzoffsetto=(ruby_value)
62
+ self.tzoffsetto_property= RiCal::PropertyValue::UtcOffset.convert(self, ruby_value)
63
+ end
64
+
65
+ # return the value of the TZOFFSETTO property
66
+ # which will be an instance of UtcOffset
67
+ def tzoffsetto
68
+ tzoffsetto_property ? tzoffsetto_property.ruby_value : nil
69
+ end
70
+
71
+ def tzoffsetto_property_from_string(line) # :nodoc:
72
+ @tzoffsetto_property = RiCal::PropertyValue::UtcOffset.new(self, line)
73
+ end
74
+
75
+
76
+ # return the the TZOFFSETFROM property
77
+ # which will be an instances of RiCal::PropertyValueUtcOffset
78
+ #
79
+ # [purpose (from RFC 2445)]
80
+ # This property specifies the offset which is in use prior to this time zone observance
81
+ #
82
+ # see RFC 2445 4.8.3.3 pp 99-100
83
+ def tzoffsetfrom_property
84
+ @tzoffsetfrom_property
85
+ end
86
+
87
+ # set the TZOFFSETFROM property
88
+ # property value should be an instance of RiCal::PropertyValueUtcOffset
89
+ def tzoffsetfrom_property=(property_value)
90
+ @tzoffsetfrom_property = property_value
91
+ end
92
+
93
+ # set the value of the TZOFFSETFROM property
94
+ def tzoffsetfrom=(ruby_value)
95
+ self.tzoffsetfrom_property= RiCal::PropertyValue::UtcOffset.convert(self, ruby_value)
96
+ end
97
+
98
+ # return the value of the TZOFFSETFROM property
99
+ # which will be an instance of UtcOffset
100
+ def tzoffsetfrom
101
+ tzoffsetfrom_property ? tzoffsetfrom_property.ruby_value : nil
102
+ end
103
+
104
+ def tzoffsetfrom_property_from_string(line) # :nodoc:
105
+ @tzoffsetfrom_property = RiCal::PropertyValue::UtcOffset.new(self, line)
106
+ end
107
+
108
+
109
+ # return the the COMMENT property
110
+ # which will be an array of instances of RiCal::PropertyValueText
111
+ #
112
+ # [purpose (from RFC 2445)]
113
+ # This property specifies non-processing information intended to provide a comment to the calendar user.
114
+ #
115
+ # see RFC 2445 4.8.1.4 pp 80-81
116
+ def comment_property
117
+ @comment_property ||= []
118
+ end
119
+
120
+ # set the the COMMENT property
121
+ # one or more instances of RiCal::PropertyValueText may be passed to this method
122
+ def comment_property=(*property_values)
123
+ @comment_property= property_values
124
+ end
125
+
126
+ # set the value of the COMMENT property to multiple values
127
+ # one or more instances of String may be passed to this method
128
+ def comments=(ruby_values)
129
+ @comment_property = ruby_values.map {|val| RiCal::PropertyValue::Text.convert(self, val)}
130
+ end
131
+
132
+ # set the value of the COMMENT property to a single value
133
+ # one instance of String may be passed to this method
134
+ def comment=(ruby_value)
135
+ @comment_property = [RiCal::PropertyValue::Text.convert(self, ruby_value)]
136
+ end
137
+
138
+ # add one or more values to the COMMENT property
139
+ # one or more instances of String may be passed to this method
140
+ def add_comments(*ruby_values)
141
+ ruby_values.each {|val| self.comment_property << RiCal::PropertyValue::Text.convert(self, val)}
142
+ end
143
+
144
+ # add one value to the COMMENT property
145
+ # one instances of String may be passed to this method
146
+ def add_comment(ruby_value)
147
+ self.comment_property << RiCal::PropertyValue::Text.convert(self, ruby_value)
148
+ end
149
+
150
+ # remove one or more values from the COMMENT property
151
+ # one or more instances of String may be passed to this method
152
+ def remove_comments(*ruby_values)
153
+ ruby_values.each {|val| self.comment_property.delete(RiCal::PropertyValue::Text.convert(self, val))}
154
+ end
155
+
156
+ # remove one value from the COMMENT property
157
+ # one instances of String may be passed to this method
158
+ def remove_comment(ruby_value)
159
+ self.comment_property.delete(RiCal::PropertyValue::Text.convert(self, ruby_value))
160
+ end
161
+
162
+ # return the value of the COMMENT property
163
+ # which will be an array of instances of String
164
+ def comment
165
+ comment_property.map {|prop| prop ? prop.ruby_value : prop}
166
+ end
167
+
168
+ def comment_property_from_string(line) # :nodoc:
169
+ comment_property << RiCal::PropertyValue::Text.new(self, line)
170
+ end
171
+
172
+ # return the the RDATE property
173
+ # which will be an array of instances of RiCal::PropertyValueOccurrenceList
174
+ #
175
+ # [purpose (from RFC 2445)]
176
+ # This property defines the list of date/times for a recurring calendar component.
177
+ #
178
+ # see RFC 2445 4.8.5.3 pp 115-117
179
+ def rdate_property
180
+ @rdate_property ||= []
181
+ end
182
+
183
+ # set the the RDATE property
184
+ # one or more instances of RiCal::PropertyValueOccurrenceList may be passed to this method
185
+ def rdate_property=(*property_values)
186
+ @rdate_property= property_values.map{|prop| prop.for_parent(self)}
187
+ end
188
+
189
+ # set the value of the RDATE property to multiple values
190
+ # one or more instances of OccurrenceList may be passed to this method
191
+ def rdates=(ruby_values)
192
+ @rdate_property = ruby_values.map {|val| RiCal::PropertyValue::OccurrenceList.convert(self, *val)}
193
+ end
194
+
195
+ # set the value of the RDATE property to a single value
196
+ # one instance of OccurrenceList may be passed to this method
197
+ def rdate=(*ruby_value)
198
+ @rdate_property = [RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value)]
199
+ end
200
+
201
+ # add one or more values to the RDATE property
202
+ # one or more instances of OccurrenceList may be passed to this method
203
+ def add_rdates(*ruby_values)
204
+ ruby_values.each {|val| self.rdate_property << RiCal::PropertyValue::OccurrenceList.convert(self, *val)}
205
+ end
206
+
207
+ # add one value to the RDATE property
208
+ # one instances of OccurrenceList may be passed to this method
209
+ def add_rdate(*ruby_value)
210
+ self.rdate_property << RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value)
211
+ end
212
+
213
+ # remove one or more values from the RDATE property
214
+ # one or more instances of OccurrenceList may be passed to this method
215
+ def remove_rdates(*ruby_values)
216
+ ruby_values.each {|val| self.rdate_property.delete(RiCal::PropertyValue::OccurrenceList.convert(self, *val))}
217
+ end
218
+
219
+ # remove one value from the RDATE property
220
+ # one instances of OccurrenceList may be passed to this method
221
+ def remove_rdate(*ruby_value)
222
+ self.rdate_property.delete(RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value))
223
+ end
224
+
225
+ # return the value of the RDATE property
226
+ # which will be an array of instances of OccurrenceList
227
+ def rdate
228
+ rdate_property.map {|prop| prop ? prop.ruby_value : prop}
229
+ end
230
+
231
+ def rdate_property_from_string(line) # :nodoc:
232
+ rdate_property << RiCal::PropertyValue::OccurrenceList.new(self, line)
233
+ end
234
+
235
+ # return the the RRULE property
236
+ # which will be an array of instances of RiCal::PropertyValueRecurrenceRule
237
+ #
238
+ # [purpose (from RFC 2445)]
239
+ # This property defines a rule or repeating pattern for recurring events, to-dos, or time zone definitions.
240
+ #
241
+ # see RFC 2445 4.8.5.4 pp 117-125
242
+ def rrule_property
243
+ @rrule_property ||= []
244
+ end
245
+
246
+ # set the the RRULE property
247
+ # one or more instances of RiCal::PropertyValueRecurrenceRule may be passed to this method
248
+ def rrule_property=(*property_values)
249
+ @rrule_property= property_values
250
+ end
251
+
252
+ # set the value of the RRULE property to multiple values
253
+ # one or more instances of RecurrenceRule may be passed to this method
254
+ def rrules=(ruby_values)
255
+ @rrule_property = ruby_values.map {|val| RiCal::PropertyValue::RecurrenceRule.convert(self, val)}
256
+ end
257
+
258
+ # set the value of the RRULE property to a single value
259
+ # one instance of RecurrenceRule may be passed to this method
260
+ def rrule=(ruby_value)
261
+ @rrule_property = [RiCal::PropertyValue::RecurrenceRule.convert(self, ruby_value)]
262
+ end
263
+
264
+ # add one or more values to the RRULE property
265
+ # one or more instances of RecurrenceRule may be passed to this method
266
+ def add_rrules(*ruby_values)
267
+ ruby_values.each {|val| self.rrule_property << RiCal::PropertyValue::RecurrenceRule.convert(self, val)}
268
+ end
269
+
270
+ # add one value to the RRULE property
271
+ # one instances of RecurrenceRule may be passed to this method
272
+ def add_rrule(ruby_value)
273
+ self.rrule_property << RiCal::PropertyValue::RecurrenceRule.convert(self, ruby_value)
274
+ end
275
+
276
+ # remove one or more values from the RRULE property
277
+ # one or more instances of RecurrenceRule may be passed to this method
278
+ def remove_rrules(*ruby_values)
279
+ ruby_values.each {|val| self.rrule_property.delete(RiCal::PropertyValue::RecurrenceRule.convert(self, val))}
280
+ end
281
+
282
+ # remove one value from the RRULE property
283
+ # one instances of RecurrenceRule may be passed to this method
284
+ def remove_rrule(ruby_value)
285
+ self.rrule_property.delete(RiCal::PropertyValue::RecurrenceRule.convert(self, ruby_value))
286
+ end
287
+
288
+ # return the value of the RRULE property
289
+ # which will be an array of instances of RecurrenceRule
290
+ def rrule
291
+ rrule_property.map {|prop| prop ? prop.ruby_value : prop}
292
+ end
293
+
294
+ def rrule_property_from_string(line) # :nodoc:
295
+ rrule_property << RiCal::PropertyValue::RecurrenceRule.new(self, line)
296
+ end
297
+
298
+ # return the the TZNAME property
299
+ # which will be an array of instances of RiCal::PropertyValueText
300
+ #
301
+ # [purpose (from RFC 2445)]
302
+ # This property specifies the customary designation for a time zone description.
303
+ #
304
+ # see RFC 2445 4.8.3.2 p 99
305
+ def tzname_property
306
+ @tzname_property ||= []
307
+ end
308
+
309
+ # set the the TZNAME property
310
+ # one or more instances of RiCal::PropertyValueText may be passed to this method
311
+ def tzname_property=(*property_values)
312
+ @tzname_property= property_values
313
+ end
314
+
315
+ # set the value of the TZNAME property to multiple values
316
+ # one or more instances of String may be passed to this method
317
+ def tznames=(ruby_values)
318
+ @tzname_property = ruby_values.map {|val| RiCal::PropertyValue::Text.convert(self, val)}
319
+ end
320
+
321
+ # set the value of the TZNAME property to a single value
322
+ # one instance of String may be passed to this method
323
+ def tzname=(ruby_value)
324
+ @tzname_property = [RiCal::PropertyValue::Text.convert(self, ruby_value)]
325
+ end
326
+
327
+ # add one or more values to the TZNAME property
328
+ # one or more instances of String may be passed to this method
329
+ def add_tznames(*ruby_values)
330
+ ruby_values.each {|val| self.tzname_property << RiCal::PropertyValue::Text.convert(self, val)}
331
+ end
332
+
333
+ # add one value to the TZNAME property
334
+ # one instances of String may be passed to this method
335
+ def add_tzname(ruby_value)
336
+ self.tzname_property << RiCal::PropertyValue::Text.convert(self, ruby_value)
337
+ end
338
+
339
+ # remove one or more values from the TZNAME property
340
+ # one or more instances of String may be passed to this method
341
+ def remove_tznames(*ruby_values)
342
+ ruby_values.each {|val| self.tzname_property.delete(RiCal::PropertyValue::Text.convert(self, val))}
343
+ end
344
+
345
+ # remove one value from the TZNAME property
346
+ # one instances of String may be passed to this method
347
+ def remove_tzname(ruby_value)
348
+ self.tzname_property.delete(RiCal::PropertyValue::Text.convert(self, ruby_value))
349
+ end
350
+
351
+ # return the value of the TZNAME property
352
+ # which will be an array of instances of String
353
+ def tzname
354
+ tzname_property.map {|prop| prop ? prop.ruby_value : prop}
355
+ end
356
+
357
+ def tzname_property_from_string(line) # :nodoc:
358
+ tzname_property << RiCal::PropertyValue::Text.new(self, line)
359
+ end
360
+
361
+ def export_properties_to(export_stream) #:nodoc:
362
+ export_prop_to(export_stream, "TZOFFSETTO", @tzoffsetto_property)
363
+ export_prop_to(export_stream, "DTSTART", @dtstart_property)
364
+ export_prop_to(export_stream, "RRULE", @rrule_property)
365
+ export_prop_to(export_stream, "TZOFFSETFROM", @tzoffsetfrom_property)
366
+ export_prop_to(export_stream, "TZNAME", @tzname_property)
367
+ export_prop_to(export_stream, "RDATE", @rdate_property)
368
+ export_prop_to(export_stream, "COMMENT", @comment_property)
369
+ end
370
+
371
+ def ==(o) #:nodoc:
372
+ if o.class == self.class
373
+ (tzoffsetto_property == o.tzoffsetto_property) &&
374
+ (dtstart_property == o.dtstart_property) &&
375
+ (rrule_property == o.rrule_property) &&
376
+ (tzoffsetfrom_property == o.tzoffsetfrom_property) &&
377
+ (tzname_property == o.tzname_property) &&
378
+ (rdate_property == o.rdate_property) &&
379
+ (comment_property == o.comment_property)
380
+ else
381
+ super
382
+ end
383
+ end
384
+
385
+ def initialize_copy(o) #:nodoc:
386
+ super
387
+ tzoffsetto_property = tzoffsetto_property && tzoffsetto_property.dup
388
+ dtstart_property = dtstart_property && dtstart_property.dup
389
+ rrule_property = rrule_property && rrule_property.dup
390
+ tzoffsetfrom_property = tzoffsetfrom_property && tzoffsetfrom_property.dup
391
+ tzname_property = tzname_property && tzname_property.dup
392
+ rdate_property = rdate_property && rdate_property.dup
393
+ comment_property = comment_property && comment_property.dup
394
+ end
395
+
396
+ def add_date_times_to(required_timezones) #:nodoc:
397
+ add_property_date_times_to(required_timezones, dtstart_property)
398
+ add_property_date_times_to(required_timezones, rdate_property)
399
+ end
400
+
401
+ module ClassMethods #:nodoc:
402
+ def property_parser #:nodoc:
403
+ {"RDATE"=>:rdate_property_from_string, "DTSTART"=>:dtstart_property_from_string, "TZNAME"=>:tzname_property_from_string, "RRULE"=>:rrule_property_from_string, "TZOFFSETFROM"=>:tzoffsetfrom_property_from_string, "COMMENT"=>:comment_property_from_string, "TZOFFSETTO"=>:tzoffsetto_property_from_string}
404
+ end
405
+ end
406
+
407
+ def self.included(mod) #:nodoc:
408
+ mod.extend ClassMethods
409
+ end
410
+
411
+ def mutual_exclusion_violation #:nodoc:
412
+ false
413
+ end
414
+ end
415
+ end
416
+ end