justinsoong-ri_cal 0.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. data/History.txt +402 -0
  2. data/Manifest.txt +161 -0
  3. data/README.txt +410 -0
  4. data/Rakefile +69 -0
  5. data/VERSION +1 -0
  6. data/bin/ri_cal +8 -0
  7. data/component_attributes/alarm.yml +10 -0
  8. data/component_attributes/calendar.yml +4 -0
  9. data/component_attributes/component_property_defs.yml +180 -0
  10. data/component_attributes/event.yml +45 -0
  11. data/component_attributes/freebusy.yml +16 -0
  12. data/component_attributes/journal.yml +35 -0
  13. data/component_attributes/timezone.yml +3 -0
  14. data/component_attributes/timezone_period.yml +11 -0
  15. data/component_attributes/todo.yml +46 -0
  16. data/copyrights.txt +1 -0
  17. data/docs/draft-ietf-calsify-2446bis-08.txt +7280 -0
  18. data/docs/draft-ietf-calsify-rfc2445bis-09.txt +10416 -0
  19. data/docs/incrementers.txt +7 -0
  20. data/docs/rfc2445.pdf +0 -0
  21. data/lib/ri_cal/component/alarm.rb +19 -0
  22. data/lib/ri_cal/component/calendar.rb +258 -0
  23. data/lib/ri_cal/component/event.rb +58 -0
  24. data/lib/ri_cal/component/freebusy.rb +16 -0
  25. data/lib/ri_cal/component/journal.rb +27 -0
  26. data/lib/ri_cal/component/non_standard.rb +33 -0
  27. data/lib/ri_cal/component/t_z_info_timezone.rb +153 -0
  28. data/lib/ri_cal/component/timezone/daylight_period.rb +25 -0
  29. data/lib/ri_cal/component/timezone/standard_period.rb +23 -0
  30. data/lib/ri_cal/component/timezone/timezone_period.rb +76 -0
  31. data/lib/ri_cal/component/timezone.rb +197 -0
  32. data/lib/ri_cal/component/todo.rb +42 -0
  33. data/lib/ri_cal/component.rb +256 -0
  34. data/lib/ri_cal/core_extensions/array/conversions.rb +15 -0
  35. data/lib/ri_cal/core_extensions/array.rb +7 -0
  36. data/lib/ri_cal/core_extensions/date/conversions.rb +56 -0
  37. data/lib/ri_cal/core_extensions/date.rb +13 -0
  38. data/lib/ri_cal/core_extensions/date_time/conversions.rb +50 -0
  39. data/lib/ri_cal/core_extensions/date_time.rb +15 -0
  40. data/lib/ri_cal/core_extensions/object/conversions.rb +20 -0
  41. data/lib/ri_cal/core_extensions/object.rb +8 -0
  42. data/lib/ri_cal/core_extensions/string/conversions.rb +57 -0
  43. data/lib/ri_cal/core_extensions/string.rb +8 -0
  44. data/lib/ri_cal/core_extensions/time/calculations.rb +153 -0
  45. data/lib/ri_cal/core_extensions/time/conversions.rb +42 -0
  46. data/lib/ri_cal/core_extensions/time/tzid_access.rb +50 -0
  47. data/lib/ri_cal/core_extensions/time/week_day_predicates.rb +55 -0
  48. data/lib/ri_cal/core_extensions/time.rb +14 -0
  49. data/lib/ri_cal/core_extensions.rb +11 -0
  50. data/lib/ri_cal/fast_date_time.rb +234 -0
  51. data/lib/ri_cal/floating_timezone.rb +32 -0
  52. data/lib/ri_cal/invalid_property_value.rb +8 -0
  53. data/lib/ri_cal/invalid_timezone_identifier.rb +20 -0
  54. data/lib/ri_cal/occurrence_enumerator.rb +265 -0
  55. data/lib/ri_cal/occurrence_period.rb +17 -0
  56. data/lib/ri_cal/parser.rb +145 -0
  57. data/lib/ri_cal/properties/alarm.rb +390 -0
  58. data/lib/ri_cal/properties/calendar.rb +164 -0
  59. data/lib/ri_cal/properties/event.rb +1523 -0
  60. data/lib/ri_cal/properties/freebusy.rb +593 -0
  61. data/lib/ri_cal/properties/journal.rb +1237 -0
  62. data/lib/ri_cal/properties/timezone.rb +150 -0
  63. data/lib/ri_cal/properties/timezone_period.rb +416 -0
  64. data/lib/ri_cal/properties/todo.rb +1559 -0
  65. data/lib/ri_cal/properties.rb +12 -0
  66. data/lib/ri_cal/property_value/array.rb +27 -0
  67. data/lib/ri_cal/property_value/cal_address.rb +11 -0
  68. data/lib/ri_cal/property_value/date.rb +184 -0
  69. data/lib/ri_cal/property_value/date_time/additive_methods.rb +44 -0
  70. data/lib/ri_cal/property_value/date_time/time_machine.rb +159 -0
  71. data/lib/ri_cal/property_value/date_time/timezone_support.rb +100 -0
  72. data/lib/ri_cal/property_value/date_time.rb +359 -0
  73. data/lib/ri_cal/property_value/duration.rb +110 -0
  74. data/lib/ri_cal/property_value/geo.rb +11 -0
  75. data/lib/ri_cal/property_value/integer.rb +12 -0
  76. data/lib/ri_cal/property_value/occurrence_list.rb +144 -0
  77. data/lib/ri_cal/property_value/period.rb +86 -0
  78. data/lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb +100 -0
  79. data/lib/ri_cal/property_value/recurrence_rule/enumerator.rb +79 -0
  80. data/lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb +148 -0
  81. data/lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb +53 -0
  82. data/lib/ri_cal/property_value/recurrence_rule/numbered_span.rb +31 -0
  83. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_day_incrementer.rb +86 -0
  84. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_hour_incrementer.rb +31 -0
  85. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_minute_incrementer.rb +32 -0
  86. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_month_incrementer.rb +52 -0
  87. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_monthday_incrementer.rb +31 -0
  88. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb +38 -0
  89. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_second_incrementer.rb +32 -0
  90. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_weekno_incrementer.rb +69 -0
  91. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_yearday_incrementer.rb +31 -0
  92. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/daily_incrementer.rb +28 -0
  93. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/frequency_incrementer.rb +80 -0
  94. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/hourly_incrementer.rb +23 -0
  95. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/list_incrementer.rb +106 -0
  96. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/minutely_incrementer.rb +23 -0
  97. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/monthly_incrementer.rb +33 -0
  98. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/null_sub_cycle_incrementer.rb +43 -0
  99. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/secondly_incrementer.rb +28 -0
  100. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/weekly_incrementer.rb +37 -0
  101. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb +57 -0
  102. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer.rb +135 -0
  103. data/lib/ri_cal/property_value/recurrence_rule/recurring_day.rb +131 -0
  104. data/lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb +64 -0
  105. data/lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb +33 -0
  106. data/lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb +53 -0
  107. data/lib/ri_cal/property_value/recurrence_rule/time_manipulation.rb +42 -0
  108. data/lib/ri_cal/property_value/recurrence_rule/validations.rb +125 -0
  109. data/lib/ri_cal/property_value/recurrence_rule.rb +154 -0
  110. data/lib/ri_cal/property_value/text.rb +44 -0
  111. data/lib/ri_cal/property_value/uri.rb +11 -0
  112. data/lib/ri_cal/property_value/utc_offset.rb +33 -0
  113. data/lib/ri_cal/property_value/zulu_date_time.rb +34 -0
  114. data/lib/ri_cal/property_value.rb +159 -0
  115. data/lib/ri_cal/required_timezones.rb +55 -0
  116. data/lib/ri_cal.rb +187 -0
  117. data/parked_specs/ri_cal/claudio_a_bug_spec.rb +100 -0
  118. data/performance/empty_propval/subject.rb +43 -0
  119. data/performance/paris_eastern/subject.rb +90 -0
  120. data/performance/penultimate_weekday/subject.rb +15 -0
  121. data/performance/psm_big_enum/ical.ics +3171 -0
  122. data/performance/psm_big_enum/subject.rb +16 -0
  123. data/performance/utah_cycling/subject.rb +55 -0
  124. data/ri_cal.gemspec +244 -0
  125. data/script/benchmark_subject +23 -0
  126. data/script/console +10 -0
  127. data/script/destroy +14 -0
  128. data/script/generate +14 -0
  129. data/script/profile_subject +29 -0
  130. data/script/txt2html +71 -0
  131. data/spec/ri_cal/bugreports_spec.rb +276 -0
  132. data/spec/ri_cal/component/alarm_spec.rb +12 -0
  133. data/spec/ri_cal/component/calendar_spec.rb +88 -0
  134. data/spec/ri_cal/component/event_spec.rb +735 -0
  135. data/spec/ri_cal/component/freebusy_spec.rb +12 -0
  136. data/spec/ri_cal/component/journal_spec.rb +37 -0
  137. data/spec/ri_cal/component/t_z_info_timezone_spec.rb +60 -0
  138. data/spec/ri_cal/component/timezone_spec.rb +236 -0
  139. data/spec/ri_cal/component/todo_spec.rb +112 -0
  140. data/spec/ri_cal/component_spec.rb +224 -0
  141. data/spec/ri_cal/core_extensions/string/conversions_spec.rb +78 -0
  142. data/spec/ri_cal/core_extensions/time/calculations_spec.rb +188 -0
  143. data/spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb +45 -0
  144. data/spec/ri_cal/fast_date_time_spec.rb +77 -0
  145. data/spec/ri_cal/inf_loop_spec.rb +78 -0
  146. data/spec/ri_cal/occurrence_enumerator_spec.rb +611 -0
  147. data/spec/ri_cal/parser_spec.rb +337 -0
  148. data/spec/ri_cal/property_value/date_spec.rb +53 -0
  149. data/spec/ri_cal/property_value/date_time_spec.rb +383 -0
  150. data/spec/ri_cal/property_value/duration_spec.rb +126 -0
  151. data/spec/ri_cal/property_value/occurrence_list_spec.rb +72 -0
  152. data/spec/ri_cal/property_value/period_spec.rb +63 -0
  153. data/spec/ri_cal/property_value/recurrence_rule/recurring_year_day_spec.rb +21 -0
  154. data/spec/ri_cal/property_value/recurrence_rule_spec.rb +1814 -0
  155. data/spec/ri_cal/property_value/text_spec.rb +25 -0
  156. data/spec/ri_cal/property_value/utc_offset_spec.rb +48 -0
  157. data/spec/ri_cal/property_value_spec.rb +125 -0
  158. data/spec/ri_cal/required_timezones_spec.rb +67 -0
  159. data/spec/ri_cal_spec.rb +53 -0
  160. data/spec/spec.opts +4 -0
  161. data/spec/spec_helper.rb +50 -0
  162. data/tasks/gem_loader/load_active_support.rb +3 -0
  163. data/tasks/gem_loader/load_tzinfo_gem.rb +2 -0
  164. data/tasks/ri_cal.rake +412 -0
  165. data/tasks/spec.rake +102 -0
  166. metadata +264 -0
@@ -0,0 +1,145 @@
1
+ module RiCal
2
+ #- ©2009 Rick DeNatale
3
+ #- All rights reserved. Refer to the file README.txt for the license
4
+ #
5
+ class Parser # :nodoc:
6
+ attr_reader :last_line_str #:nodoc:
7
+ def next_line #:nodoc:
8
+ result = nil
9
+ begin
10
+ result = buffer_or_line
11
+ @buffer = nil
12
+ while /^\s/ =~ buffer_or_line
13
+ result = "#{result}#{@buffer[1..-1]}"
14
+ @buffer = nil
15
+ end
16
+ rescue EOFError
17
+ return nil
18
+ ensure
19
+ return result
20
+ end
21
+ end
22
+
23
+ def self.parse_params(string) #:nodoc:
24
+ if string
25
+ string.split(";").inject({}) { |result, val|
26
+ m = /^(.+)=(.+)$/.match(val)
27
+ raise "Invalid parameter value #{val.inspect}" unless m
28
+ #TODO - The gsub below is a simplest fix for http://rick_denatale.lighthouseapp.com/projects/30941/tickets/19
29
+ # it may need further examination if more pathological cases show up.
30
+ param_val = m[2].sub(/^\"(.*)\"$/, '\1')
31
+ result[m[1]] = param_val
32
+ result
33
+ }
34
+ else
35
+ nil
36
+ end
37
+ end
38
+
39
+ def self.params_and_value(string, optional_initial_semi = false) #:nodoc:
40
+ string = string.sub(/^:/,'')
41
+ return [{}, string] unless optional_initial_semi || string.match(/^;/)
42
+ segments = string.sub(';','').split(":", -1)
43
+ return [{}, string] if segments.length < 2
44
+ quote_count = 0
45
+ gathering_params = true
46
+ params = []
47
+ values = []
48
+ segments.each do |segment|
49
+ if gathering_params
50
+ params << segment
51
+ quote_count += segment.count("\"")
52
+ gathering_params = (1 == quote_count % 2)
53
+ else
54
+ values << segment
55
+ end
56
+ end
57
+ [parse_params(params.join(":")), values.join(":")]
58
+ end
59
+
60
+ def separate_line(string) #:nodoc:
61
+ match = string.match(/^([^;:]*)(.*)$/)
62
+ name = match[1]
63
+ @last_line_str = string
64
+ params, value = *Parser.params_and_value(match[2])
65
+ {
66
+ :name => name,
67
+ :params => params,
68
+ :value => value,
69
+ }
70
+ end
71
+
72
+ def next_separated_line #:nodoc:
73
+ line = next_line
74
+ line ? separate_line(line) : nil
75
+ end
76
+
77
+ def buffer_or_line #:nodoc:
78
+ @buffer ||= @io.readline.chomp
79
+ end
80
+
81
+ def initialize(io = StringIO.new("")) #:nodoc:
82
+ @io = io
83
+ end
84
+
85
+ def self.parse(io = StringIO.new("")) #:nodoc:
86
+ new(io).parse
87
+ end
88
+
89
+ def invalid #:nodoc:
90
+ raise Exception.new("Invalid icalendar file")
91
+ end
92
+
93
+ def still_in(component, separated_line) #:nodoc:
94
+ invalid unless separated_line
95
+ separated_line[:value] != component || separated_line[:name] != "END"
96
+ end
97
+
98
+ def parse #:nodoc:
99
+ result = []
100
+ while start_line = next_line
101
+ @parent_stack = []
102
+ component = parse_one(start_line, nil)
103
+ result << component if component
104
+ end
105
+ result
106
+ end
107
+
108
+ # TODO: Need to parse non-standard component types (iana-token or x-name)
109
+ def parse_one(start, parent_component) #:nodoc:
110
+
111
+ @parent_stack << parent_component
112
+ if Hash === start
113
+ first_line = start
114
+ else
115
+ first_line = separate_line(start)
116
+ end
117
+ invalid unless first_line[:name] == "BEGIN"
118
+ entity_name = first_line[:value]
119
+ result = case entity_name
120
+ when "VCALENDAR"
121
+ RiCal::Component::Calendar.from_parser(self, parent_component, entity_name)
122
+ when "VEVENT"
123
+ RiCal::Component::Event.from_parser(self, parent_component, entity_name)
124
+ when "VTODO"
125
+ RiCal::Component::Todo.from_parser(self, parent_component, entity_name)
126
+ when "VJOURNAL"
127
+ RiCal::Component::Journal.from_parser(self, parent_component, entity_name)
128
+ when "VFREEBUSY"
129
+ RiCal::Component::Freebusy.from_parser(self, parent_component, entity_name)
130
+ when "VTIMEZONE"
131
+ RiCal::Component::Timezone.from_parser(self, parent_component, entity_name)
132
+ when "VALARM"
133
+ RiCal::Component::Alarm.from_parser(self, parent_component, entity_name)
134
+ when "DAYLIGHT"
135
+ RiCal::Component::Timezone::DaylightPeriod.from_parser(self, parent_component, entity_name)
136
+ when "STANDARD"
137
+ RiCal::Component::Timezone::StandardPeriod.from_parser(self, parent_component, entity_name)
138
+ else
139
+ RiCal::Component::NonStandard.from_parser(self, parent_component, entity_name)
140
+ end
141
+ @parent_stack.pop
142
+ result
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,390 @@
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::Alarm provides property accessing methods for the Alarm class
7
+ # This source file is generated by the rical:gen_propmodules rake tasks, DO NOT EDIT
8
+ module Alarm
9
+
10
+ # return the the ACTION property
11
+ # which will be an instances of RiCal::PropertyValueText
12
+ #
13
+ # [purpose (from RFC 2445)]
14
+ # This property defines the action to be invoked when an alarm is triggered
15
+ #
16
+ # see RFC 2445 4.8.6.1 p 126
17
+ def action_property
18
+ @action_property
19
+ end
20
+
21
+ # set the ACTION property
22
+ # property value should be an instance of RiCal::PropertyValueText
23
+ def action_property=(property_value)
24
+ @action_property = property_value
25
+ end
26
+
27
+ # set the value of the ACTION property
28
+ def action=(ruby_value)
29
+ self.action_property= RiCal::PropertyValue::Text.convert(self, ruby_value)
30
+ end
31
+
32
+ # return the value of the ACTION property
33
+ # which will be an instance of String
34
+ def action
35
+ action_property ? action_property.ruby_value : nil
36
+ end
37
+
38
+ def action_property_from_string(line) # :nodoc:
39
+ @action_property = RiCal::PropertyValue::Text.new(self, line)
40
+ end
41
+
42
+
43
+ # return the the DESCRIPTION property
44
+ # which will be an instances of RiCal::PropertyValueText
45
+ #
46
+ # [purpose (from RFC 2445)]
47
+ # This property provides a more complete description of the calendar component, than that provided by the "SUMMARY" property.
48
+ #
49
+ # see RFC 2445 4.8.1.5 pp 81-82
50
+ def description_property
51
+ @description_property
52
+ end
53
+
54
+ # set the DESCRIPTION property
55
+ # property value should be an instance of RiCal::PropertyValueText
56
+ def description_property=(property_value)
57
+ @description_property = property_value
58
+ end
59
+
60
+ # set the value of the DESCRIPTION property
61
+ def description=(ruby_value)
62
+ self.description_property= RiCal::PropertyValue::Text.convert(self, ruby_value)
63
+ end
64
+
65
+ # return the value of the DESCRIPTION property
66
+ # which will be an instance of String
67
+ def description
68
+ description_property ? description_property.ruby_value : nil
69
+ end
70
+
71
+ def description_property_from_string(line) # :nodoc:
72
+ @description_property = RiCal::PropertyValue::Text.new(self, line)
73
+ end
74
+
75
+
76
+ # return the the TRIGGER property
77
+ # which will be an instances of RiCal::PropertyValueDuration
78
+ #
79
+ # [purpose (from RFC 2445)]
80
+ # This property specifies when an alarm will trigger.
81
+ #
82
+ # see RFC 2445 4.8.6.3 p 127-129
83
+ def trigger_property
84
+ @trigger_property
85
+ end
86
+
87
+ # set the TRIGGER property
88
+ # property value should be an instance of RiCal::PropertyValueDuration
89
+ def trigger_property=(property_value)
90
+ @trigger_property = property_value
91
+ end
92
+
93
+ # set the value of the TRIGGER property
94
+ def trigger=(ruby_value)
95
+ self.trigger_property= RiCal::PropertyValue::Duration.convert(self, ruby_value)
96
+ end
97
+
98
+ # return the value of the TRIGGER property
99
+ # which will be an instance of Duration
100
+ def trigger
101
+ trigger_property ? trigger_property.ruby_value : nil
102
+ end
103
+
104
+ def trigger_property_from_string(line) # :nodoc:
105
+ @trigger_property = RiCal::PropertyValue::Duration.new(self, line)
106
+ end
107
+
108
+
109
+ # return the the DURATION property
110
+ # which will be an instances of RiCal::PropertyValueDuration
111
+ #
112
+ # [purpose (from RFC 2445)]
113
+ # This property specifies a positive duration of time.
114
+ #
115
+ # see RFC 2445 4.8.2.5 pp 94-95
116
+ def duration_property
117
+ @duration_property
118
+ end
119
+
120
+ # set the DURATION property
121
+ # property value should be an instance of RiCal::PropertyValueDuration
122
+ def duration_property=(property_value)
123
+ @duration_property = property_value
124
+ end
125
+
126
+ # set the value of the DURATION property
127
+ def duration=(ruby_value)
128
+ self.duration_property= RiCal::PropertyValue::Duration.convert(self, ruby_value)
129
+ end
130
+
131
+ # return the value of the DURATION property
132
+ # which will be an instance of Duration
133
+ def duration
134
+ duration_property ? duration_property.ruby_value : nil
135
+ end
136
+
137
+ def duration_property_from_string(line) # :nodoc:
138
+ @duration_property = RiCal::PropertyValue::Duration.new(self, line)
139
+ end
140
+
141
+
142
+ # return the the REPEAT property
143
+ # which will be an instances of RiCal::PropertyValueInteger
144
+ #
145
+ # [purpose (from RFC 2445)]
146
+ # This property defines the number of times the alarm should be repeated, after the initial trigger.
147
+ #
148
+ # see RFC 2445 4.8.6.2 p 126-127
149
+ def repeat_property
150
+ @repeat_property
151
+ end
152
+
153
+ # set the REPEAT property
154
+ # property value should be an instance of RiCal::PropertyValueInteger
155
+ def repeat_property=(property_value)
156
+ @repeat_property = property_value
157
+ end
158
+
159
+ # set the value of the REPEAT property
160
+ def repeat=(ruby_value)
161
+ self.repeat_property= RiCal::PropertyValue::Integer.convert(self, ruby_value)
162
+ end
163
+
164
+ # return the value of the REPEAT property
165
+ # which will be an instance of Integer
166
+ def repeat
167
+ repeat_property ? repeat_property.ruby_value : nil
168
+ end
169
+
170
+ def repeat_property_from_string(line) # :nodoc:
171
+ @repeat_property = RiCal::PropertyValue::Integer.new(self, line)
172
+ end
173
+
174
+
175
+ # return the the SUMMARY property
176
+ # which will be an instances of RiCal::PropertyValueText
177
+ #
178
+ # [purpose (from RFC 2445)]
179
+ # This property defines a short summary or subject for the calendar component.
180
+ #
181
+ # see RFC 2445 4.8.1.12 pp 89-90
182
+ def summary_property
183
+ @summary_property
184
+ end
185
+
186
+ # set the SUMMARY property
187
+ # property value should be an instance of RiCal::PropertyValueText
188
+ def summary_property=(property_value)
189
+ @summary_property = property_value
190
+ end
191
+
192
+ # set the value of the SUMMARY property
193
+ def summary=(ruby_value)
194
+ self.summary_property= RiCal::PropertyValue::Text.convert(self, ruby_value)
195
+ end
196
+
197
+ # return the value of the SUMMARY property
198
+ # which will be an instance of String
199
+ def summary
200
+ summary_property ? summary_property.ruby_value : nil
201
+ end
202
+
203
+ def summary_property_from_string(line) # :nodoc:
204
+ @summary_property = RiCal::PropertyValue::Text.new(self, line)
205
+ end
206
+
207
+
208
+ # return the the ATTENDEE property
209
+ # which will be an array of instances of RiCal::PropertyValueCalAddress
210
+ #
211
+ # [purpose (from RFC 2445)]
212
+ # The property defines an 'Attendee' within a calendar component.
213
+ #
214
+ # see RFC 2445 4.8.4.1 pp 102-104
215
+ def attendee_property
216
+ @attendee_property ||= []
217
+ end
218
+
219
+ # set the the ATTENDEE property
220
+ # one or more instances of RiCal::PropertyValueCalAddress may be passed to this method
221
+ def attendee_property=(*property_values)
222
+ @attendee_property= property_values
223
+ end
224
+
225
+ # set the value of the ATTENDEE property to multiple values
226
+ # one or more instances of CalAddress may be passed to this method
227
+ def attendees=(ruby_values)
228
+ @attendee_property = ruby_values.map {|val| RiCal::PropertyValue::CalAddress.convert(self, val)}
229
+ end
230
+
231
+ # set the value of the ATTENDEE property to a single value
232
+ # one instance of CalAddress may be passed to this method
233
+ def attendee=(ruby_value)
234
+ @attendee_property = [RiCal::PropertyValue::CalAddress.convert(self, ruby_value)]
235
+ end
236
+
237
+ # add one or more values to the ATTENDEE property
238
+ # one or more instances of CalAddress may be passed to this method
239
+ def add_attendees(*ruby_values)
240
+ ruby_values.each {|val| self.attendee_property << RiCal::PropertyValue::CalAddress.convert(self, val)}
241
+ end
242
+
243
+ # add one value to the ATTENDEE property
244
+ # one instances of CalAddress may be passed to this method
245
+ def add_attendee(ruby_value)
246
+ self.attendee_property << RiCal::PropertyValue::CalAddress.convert(self, ruby_value)
247
+ end
248
+
249
+ # remove one or more values from the ATTENDEE property
250
+ # one or more instances of CalAddress may be passed to this method
251
+ def remove_attendees(*ruby_values)
252
+ ruby_values.each {|val| self.attendee_property.delete(RiCal::PropertyValue::CalAddress.convert(self, val))}
253
+ end
254
+
255
+ # remove one value from the ATTENDEE property
256
+ # one instances of CalAddress may be passed to this method
257
+ def remove_attendee(ruby_value)
258
+ self.attendee_property.delete(RiCal::PropertyValue::CalAddress.convert(self, ruby_value))
259
+ end
260
+
261
+ # return the value of the ATTENDEE property
262
+ # which will be an array of instances of CalAddress
263
+ def attendee
264
+ attendee_property.map {|prop| prop ? prop.ruby_value : prop}
265
+ end
266
+
267
+ def attendee_property_from_string(line) # :nodoc:
268
+ attendee_property << RiCal::PropertyValue::CalAddress.new(self, line)
269
+ end
270
+
271
+ # return the the ATTACH property
272
+ # which will be an array of instances of RiCal::PropertyValueUri
273
+ #
274
+ # [purpose (from RFC 2445)]
275
+ # The property provides the capability to associate a document object with a calendar component.
276
+ #
277
+ # see RFC 2445 4.8.1.1 pp 77-78
278
+ def attach_property
279
+ @attach_property ||= []
280
+ end
281
+
282
+ # set the the ATTACH property
283
+ # one or more instances of RiCal::PropertyValueUri may be passed to this method
284
+ def attach_property=(*property_values)
285
+ @attach_property= property_values
286
+ end
287
+
288
+ # set the value of the ATTACH property to multiple values
289
+ # one or more instances of Uri may be passed to this method
290
+ def attachments=(ruby_values)
291
+ @attach_property = ruby_values.map {|val| RiCal::PropertyValue::Uri.convert(self, val)}
292
+ end
293
+
294
+ # set the value of the ATTACH property to a single value
295
+ # one instance of Uri may be passed to this method
296
+ def attach=(ruby_value)
297
+ @attach_property = [RiCal::PropertyValue::Uri.convert(self, ruby_value)]
298
+ end
299
+
300
+ # add one or more values to the ATTACH property
301
+ # one or more instances of Uri may be passed to this method
302
+ def add_attachments(*ruby_values)
303
+ ruby_values.each {|val| self.attach_property << RiCal::PropertyValue::Uri.convert(self, val)}
304
+ end
305
+
306
+ # add one value to the ATTACH property
307
+ # one instances of Uri may be passed to this method
308
+ def add_attach(ruby_value)
309
+ self.attach_property << RiCal::PropertyValue::Uri.convert(self, ruby_value)
310
+ end
311
+
312
+ # remove one or more values from the ATTACH property
313
+ # one or more instances of Uri may be passed to this method
314
+ def remove_attachments(*ruby_values)
315
+ ruby_values.each {|val| self.attach_property.delete(RiCal::PropertyValue::Uri.convert(self, val))}
316
+ end
317
+
318
+ # remove one value from the ATTACH property
319
+ # one instances of Uri may be passed to this method
320
+ def remove_attach(ruby_value)
321
+ self.attach_property.delete(RiCal::PropertyValue::Uri.convert(self, ruby_value))
322
+ end
323
+
324
+ # return the value of the ATTACH property
325
+ # which will be an array of instances of Uri
326
+ def attach
327
+ attach_property.map {|prop| prop ? prop.ruby_value : prop}
328
+ end
329
+
330
+ def attach_property_from_string(line) # :nodoc:
331
+ attach_property << RiCal::PropertyValue::Uri.new(self, line)
332
+ end
333
+
334
+ def export_properties_to(export_stream) #:nodoc:
335
+ export_prop_to(export_stream, "DURATION", @duration_property)
336
+ export_prop_to(export_stream, "ATTENDEE", @attendee_property)
337
+ export_prop_to(export_stream, "TRIGGER", @trigger_property)
338
+ export_prop_to(export_stream, "DESCRIPTION", @description_property)
339
+ export_prop_to(export_stream, "SUMMARY", @summary_property)
340
+ export_prop_to(export_stream, "REPEAT", @repeat_property)
341
+ export_prop_to(export_stream, "ATTACH", @attach_property)
342
+ export_prop_to(export_stream, "ACTION", @action_property)
343
+ end
344
+
345
+ def ==(o) #:nodoc:
346
+ if o.class == self.class
347
+ (duration_property == o.duration_property) &&
348
+ (attendee_property == o.attendee_property) &&
349
+ (trigger_property == o.trigger_property) &&
350
+ (description_property == o.description_property) &&
351
+ (summary_property == o.summary_property) &&
352
+ (repeat_property == o.repeat_property) &&
353
+ (attach_property == o.attach_property) &&
354
+ (action_property == o.action_property)
355
+ else
356
+ super
357
+ end
358
+ end
359
+
360
+ def initialize_copy(o) #:nodoc:
361
+ super
362
+ duration_property = duration_property && duration_property.dup
363
+ attendee_property = attendee_property && attendee_property.dup
364
+ trigger_property = trigger_property && trigger_property.dup
365
+ description_property = description_property && description_property.dup
366
+ summary_property = summary_property && summary_property.dup
367
+ repeat_property = repeat_property && repeat_property.dup
368
+ attach_property = attach_property && attach_property.dup
369
+ action_property = action_property && action_property.dup
370
+ end
371
+
372
+ def add_date_times_to(required_timezones) #:nodoc:
373
+ end
374
+
375
+ module ClassMethods #:nodoc:
376
+ def property_parser #:nodoc:
377
+ {"ACTION"=>:action_property_from_string, "REPEAT"=>:repeat_property_from_string, "ATTENDEE"=>:attendee_property_from_string, "TRIGGER"=>:trigger_property_from_string, "ATTACH"=>:attach_property_from_string, "SUMMARY"=>:summary_property_from_string, "DESCRIPTION"=>:description_property_from_string, "DURATION"=>:duration_property_from_string}
378
+ end
379
+ end
380
+
381
+ def self.included(mod) #:nodoc:
382
+ mod.extend ClassMethods
383
+ end
384
+
385
+ def mutual_exclusion_violation #:nodoc:
386
+ false
387
+ end
388
+ end
389
+ end
390
+ end
@@ -0,0 +1,164 @@
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::Calendar provides property accessing methods for the Calendar class
7
+ # This source file is generated by the rical:gen_propmodules rake tasks, DO NOT EDIT
8
+ module Calendar
9
+
10
+ # return the the CALSCALE property
11
+ # which will be an instances of RiCal::PropertyValueText
12
+ #
13
+ # [purpose (from RFC 2445)]
14
+ # This property defines the calendar scale used for the calendar information specified in the calendar object.
15
+ #
16
+ # see RFC 2445 4.7.1 p 73
17
+ def calscale_property
18
+ @calscale_property ||= RiCal::PropertyValue::Text.convert(self, "GREGORIAN")
19
+ end
20
+
21
+ # return the value of the CALSCALE property
22
+ # which will be an instance of String
23
+ def calscale
24
+ calscale_property ? calscale_property.ruby_value : nil
25
+ end
26
+
27
+ def calscale_property_from_string(line) # :nodoc:
28
+ @calscale_property = RiCal::PropertyValue::Text.new(self, line)
29
+ end
30
+
31
+
32
+ # return the the METHOD property
33
+ # which will be an instances of RiCal::PropertyValueText
34
+ #
35
+ # [purpose (from RFC 2445)]
36
+ # This property defines the iCalendar object method associated with the calendar object
37
+ #
38
+ # see RFC 2445 4.7.2 p 74-75
39
+ def method_property
40
+ @method_property
41
+ end
42
+
43
+ # set the METHOD property
44
+ # property value should be an instance of RiCal::PropertyValueText
45
+ def method_property=(property_value)
46
+ @method_property = property_value
47
+ end
48
+
49
+ # set the value of the METHOD property
50
+ def icalendar_method=(ruby_value)
51
+ self.method_property= RiCal::PropertyValue::Text.convert(self, ruby_value)
52
+ end
53
+
54
+ # return the value of the METHOD property
55
+ # which will be an instance of String
56
+ def icalendar_method
57
+ method_property ? method_property.ruby_value : nil
58
+ end
59
+
60
+ def method_property_from_string(line) # :nodoc:
61
+ @method_property = RiCal::PropertyValue::Text.new(self, line)
62
+ end
63
+
64
+
65
+ # return the the PRODID property
66
+ # which will be an instances of RiCal::PropertyValueText
67
+ #
68
+ # [purpose (from RFC 2445)]
69
+ # This property specifies the identifier for the product that created the iCalendar object.
70
+ #
71
+ # see RFC 2445 4.7.3 pp 75-76
72
+ def prodid_property
73
+ @prodid_property ||= RiCal::PropertyValue::Text.convert(self, "-//com.denhaven2/NONSGML ri_cal gem//EN")
74
+ end
75
+
76
+ # set the PRODID property
77
+ # property value should be an instance of RiCal::PropertyValueText
78
+ def prodid_property=(property_value)
79
+ @prodid_property = property_value
80
+ end
81
+
82
+ # set the value of the PRODID property
83
+ def prodid=(ruby_value)
84
+ self.prodid_property= RiCal::PropertyValue::Text.convert(self, ruby_value)
85
+ end
86
+
87
+ # return the value of the PRODID property
88
+ # which will be an instance of String
89
+ def prodid
90
+ prodid_property ? prodid_property.ruby_value : nil
91
+ end
92
+
93
+ def prodid_property_from_string(line) # :nodoc:
94
+ @prodid_property = RiCal::PropertyValue::Text.new(self, line)
95
+ end
96
+
97
+
98
+ # return the the VERSION property
99
+ # which will be an instances of RiCal::PropertyValueText
100
+ #
101
+ # [purpose (from RFC 2445)]
102
+ # This property specifies the identifier corresponding to thehighest version number or the minimum and maximum range of the iCalendar specification that is required in order to interpret the iCalendar object.
103
+ #
104
+ # see RFC 2445 4.7.4 pp 76-77
105
+ def version_property
106
+ @version_property ||= RiCal::PropertyValue::Text.convert(self, "2.0")
107
+ end
108
+
109
+ # return the value of the VERSION property
110
+ # which will be an instance of String
111
+ def version
112
+ version_property ? version_property.ruby_value : nil
113
+ end
114
+
115
+ def version_property_from_string(line) # :nodoc:
116
+ @version_property = RiCal::PropertyValue::Text.new(self, line)
117
+ end
118
+
119
+
120
+ def export_properties_to(export_stream) #:nodoc:
121
+ export_prop_to(export_stream, "CALSCALE", @calscale_property)
122
+ export_prop_to(export_stream, "PRODID", @prodid_property)
123
+ export_prop_to(export_stream, "VERSION", @version_property)
124
+ export_prop_to(export_stream, "METHOD", @method_property)
125
+ end
126
+
127
+ def ==(o) #:nodoc:
128
+ if o.class == self.class
129
+ (calscale_property == o.calscale_property) &&
130
+ (prodid_property == o.prodid_property) &&
131
+ (version_property == o.version_property) &&
132
+ (method_property == o.method_property)
133
+ else
134
+ super
135
+ end
136
+ end
137
+
138
+ def initialize_copy(o) #:nodoc:
139
+ super
140
+ calscale_property = calscale_property && calscale_property.dup
141
+ prodid_property = prodid_property && prodid_property.dup
142
+ version_property = version_property && version_property.dup
143
+ method_property = method_property && method_property.dup
144
+ end
145
+
146
+ def add_date_times_to(required_timezones) #:nodoc:
147
+ end
148
+
149
+ module ClassMethods #:nodoc:
150
+ def property_parser #:nodoc:
151
+ {"METHOD"=>:method_property_from_string, "VERSION"=>:version_property_from_string, "PRODID"=>:prodid_property_from_string, "CALSCALE"=>:calscale_property_from_string}
152
+ end
153
+ end
154
+
155
+ def self.included(mod) #:nodoc:
156
+ mod.extend ClassMethods
157
+ end
158
+
159
+ def mutual_exclusion_violation #:nodoc:
160
+ false
161
+ end
162
+ end
163
+ end
164
+ end