rubyredrick-ri_cal 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +19 -2
- data/Manifest.txt +6 -3
- data/README.txt +130 -44
- data/Rakefile +1 -1
- data/copyrights.txt +1 -2
- data/lib/ri_cal/component/alarm.rb +1 -2
- data/lib/ri_cal/component/calendar.rb +25 -9
- data/lib/ri_cal/component/event.rb +1 -2
- data/lib/ri_cal/component/freebusy.rb +1 -2
- data/lib/ri_cal/component/journal.rb +1 -2
- data/lib/ri_cal/component/t_z_info_timezone.rb +1 -2
- data/lib/ri_cal/component/timezone/daylight_period.rb +1 -2
- data/lib/ri_cal/component/timezone/standard_period.rb +1 -2
- data/lib/ri_cal/component/timezone/timezone_period.rb +1 -2
- data/lib/ri_cal/component/timezone.rb +5 -2
- data/lib/ri_cal/component.rb +22 -7
- data/lib/ri_cal/core_extensions/date/conversions.rb +8 -7
- data/lib/ri_cal/core_extensions/date_time.rb +4 -2
- data/lib/ri_cal/core_extensions/object/conversions.rb +1 -1
- data/lib/ri_cal/core_extensions/string/conversions.rb +37 -6
- data/lib/ri_cal/core_extensions/time/conversions.rb +11 -7
- data/lib/ri_cal/core_extensions/time/tzid_access.rb +37 -0
- data/lib/ri_cal/core_extensions/time.rb +3 -1
- data/lib/ri_cal/floating_timezone.rb +32 -0
- data/lib/ri_cal/invalid_property_value.rb +8 -0
- data/lib/ri_cal/invalid_timezone_identifer.rb +2 -2
- data/lib/ri_cal/occurrence_enumerator.rb +5 -3
- data/lib/ri_cal/parser.rb +8 -8
- data/lib/ri_cal/properties/alarm.rb +8 -8
- data/lib/ri_cal/properties/event.rb +60 -60
- data/lib/ri_cal/properties/freebusy.rb +16 -16
- data/lib/ri_cal/properties/journal.rb +58 -58
- data/lib/ri_cal/properties/timezone_period.rb +23 -23
- data/lib/ri_cal/properties/todo.rb +63 -64
- data/lib/ri_cal/property_value/array.rb +10 -2
- data/lib/ri_cal/property_value/cal_address.rb +1 -2
- data/lib/ri_cal/property_value/date.rb +15 -3
- data/lib/ri_cal/property_value/date_time/additive_methods.rb +34 -33
- data/lib/ri_cal/property_value/date_time/time_machine.rb +175 -174
- data/lib/ri_cal/property_value/date_time/timezone_support.rb +70 -52
- data/lib/ri_cal/property_value/date_time.rb +47 -77
- data/lib/ri_cal/property_value/duration.rb +6 -3
- data/lib/ri_cal/property_value/geo.rb +1 -2
- data/lib/ri_cal/property_value/integer.rb +1 -2
- data/lib/ri_cal/property_value/occurrence_list.rb +79 -26
- data/lib/ri_cal/property_value/period.rb +23 -3
- data/lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/enumerator.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/numbered_span.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_day.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule/validations.rb +1 -2
- data/lib/ri_cal/property_value/recurrence_rule.rb +3 -4
- data/lib/ri_cal/property_value/text.rb +1 -2
- data/lib/ri_cal/property_value/uri.rb +1 -2
- data/lib/ri_cal/property_value/utc_offset.rb +1 -2
- data/lib/ri_cal/property_value.rb +42 -11
- data/lib/ri_cal/required_timezones.rb +1 -2
- data/lib/ri_cal.rb +1 -2
- data/ri_cal.gemspec +6 -4
- data/spec/ri_cal/component/alarm_spec.rb +1 -2
- data/spec/ri_cal/component/calendar_spec.rb +1 -2
- data/spec/ri_cal/component/event_spec.rb +168 -13
- data/spec/ri_cal/component/freebusy_spec.rb +1 -2
- data/spec/ri_cal/component/journal_spec.rb +1 -2
- data/spec/ri_cal/component/t_z_info_timezone_spec.rb +1 -2
- data/spec/ri_cal/component/timezone_spec.rb +1 -2
- data/spec/ri_cal/component/todo_spec.rb +4 -5
- data/spec/ri_cal/component_spec.rb +30 -18
- data/spec/ri_cal/core_extensions/string/conversions_spec.rb +78 -0
- data/spec/ri_cal/core_extensions/time/calculations_spec.rb +1 -2
- data/spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb +1 -2
- data/spec/ri_cal/occurrence_enumerator_spec.rb +23 -2
- data/spec/ri_cal/parser_spec.rb +6 -7
- data/spec/ri_cal/property_value/date_spec.rb +1 -2
- data/spec/ri_cal/property_value/date_time_spec.rb +54 -119
- data/spec/ri_cal/property_value/duration_spec.rb +12 -2
- data/spec/ri_cal/property_value/occurrence_list_spec.rb +67 -0
- data/spec/ri_cal/property_value/period_spec.rb +1 -2
- data/spec/ri_cal/property_value/recurrence_rule/recurring_year_day_spec.rb +1 -2
- data/spec/ri_cal/property_value/recurrence_rule_spec.rb +1 -2
- data/spec/ri_cal/property_value/text_spec.rb +1 -2
- data/spec/ri_cal/property_value/utc_offset_spec.rb +1 -2
- data/spec/ri_cal/property_value_spec.rb +19 -8
- data/spec/ri_cal/required_timezones_spec.rb +1 -2
- data/spec/ri_cal_spec.rb +1 -2
- data/spec/spec_helper.rb +2 -7
- data/tasks/ri_cal.rake +20 -13
- data/tasks/spec.rake +1 -1
- metadata +8 -5
- data/lib/ri_cal/core_extensions/date_time/conversions.rb +0 -27
- data/lib/ri_cal/time_with_floating_timezone.rb +0 -59
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'date'
|
2
2
|
module RiCal
|
3
3
|
class PropertyValue
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
# RiCal::PropertyValue::CalAddress represents an icalendar CalAddress property value
|
8
7
|
# which is defined in RFC 2445 section 4.3.5 pp 35-37
|
@@ -28,13 +27,17 @@ module RiCal
|
|
28
27
|
PropertyValue::Date.new(parent, line)
|
29
28
|
end
|
30
29
|
end
|
30
|
+
|
31
|
+
def self.valid_string?(string) #:nodoc:
|
32
|
+
string =~ /^\d{8}T\d{6}Z?$/
|
33
|
+
end
|
31
34
|
|
32
35
|
def self.default_tzid # :nodoc:
|
33
36
|
@default_tzid ||= "UTC"
|
34
37
|
end
|
35
38
|
|
36
39
|
def self.params_for_tzid(tzid) #:nodoc:
|
37
|
-
if tzid ==
|
40
|
+
if tzid == :floating
|
38
41
|
{}
|
39
42
|
else
|
40
43
|
{'TZID' => tzid}
|
@@ -44,12 +47,12 @@ module RiCal
|
|
44
47
|
# Set the default tzid to be used when instantiating an instance from a ruby object
|
45
48
|
# see RiCal::PropertyValue::DateTime.from_time
|
46
49
|
#
|
47
|
-
# The parameter tzid is a string value to be used for the default tzid, a value of
|
50
|
+
# The parameter tzid is a string value to be used for the default tzid, a value of :floating will cause
|
48
51
|
# values with NO timezone to be produced, which will be interpreted by iCalendar as floating times
|
49
52
|
# i.e. they are interpreted in the timezone of each client. Floating times are typically used
|
50
53
|
# to represent events which are 'repeated' in the various time zones, like the first hour of the year.
|
51
54
|
def self.default_tzid=(tzid)
|
52
|
-
@default_tzid =
|
55
|
+
@default_tzid = tzid
|
53
56
|
end
|
54
57
|
|
55
58
|
def self.default_tzid_hash # :nodoc:
|
@@ -59,7 +62,7 @@ module RiCal
|
|
59
62
|
{'TZID' => default_tzid}
|
60
63
|
end
|
61
64
|
end
|
62
|
-
|
65
|
+
|
63
66
|
def inspect # :nodoc:
|
64
67
|
"#{@date_time_value}:#{tzid}"
|
65
68
|
end
|
@@ -86,79 +89,40 @@ module RiCal
|
|
86
89
|
when nil
|
87
90
|
@date_time_value = nil
|
88
91
|
when String
|
89
|
-
self.tzid = 'UTC' if val =~/Z/
|
90
92
|
@date_time_value = ::DateTime.parse(val)
|
93
|
+
if val =~/Z/
|
94
|
+
self.tzid = 'UTC'
|
95
|
+
else
|
96
|
+
@tzid ||= :floating
|
97
|
+
end
|
91
98
|
when ::DateTime
|
92
99
|
@date_time_value = val
|
93
100
|
when ::Date, ::Time
|
94
101
|
@date_time_value = ::DateTime.parse(val.to_s)
|
95
102
|
end
|
96
103
|
end
|
97
|
-
|
104
|
+
|
98
105
|
# Extract the time and timezone identifier from an object used to set the value of a DATETIME property.
|
99
106
|
#
|
100
|
-
# If the object is
|
101
|
-
# identifier string as the second element
|
107
|
+
# If the object is a string it should be of the form [TZID=identifier:]
|
102
108
|
#
|
103
109
|
# Otherwise determine if the object acts like an activesupport enhanced time, and extract its timezone
|
104
110
|
# idenfifier if it has one.
|
105
111
|
#
|
106
|
-
def self.
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
activesupport_time = object.acts_like_time? rescue nil
|
111
|
-
time_zone = activesupport_time && object.time_zone rescue nil
|
112
|
-
identifier = time_zone && (time_zone.respond_to?(:tzinfo) ? time_zone.tzinfo : time_zone).identifier
|
113
|
-
end
|
114
|
-
[object, identifier]
|
115
|
-
end
|
116
|
-
|
117
|
-
# A hack to detect whether an array passed to convert is a
|
118
|
-
def self.single_time_or_date?(ruby_object)
|
119
|
-
if (::Array === ruby_object)
|
120
|
-
if (ruby_object.length == 2) && (::String === ruby_object[1])
|
121
|
-
case ruby_object[0]
|
122
|
-
when ::Date, ::DateTime, ::Time, PropertyValue::Date, PropertyValue::DateTime
|
123
|
-
ruby_object
|
124
|
-
else
|
125
|
-
nil
|
126
|
-
end
|
127
|
-
end
|
112
|
+
def self.time_and_parameters(object)
|
113
|
+
parameters = {}
|
114
|
+
if ::String === object
|
115
|
+
object, parameters = self.time_and_parameters_from_string(object)
|
128
116
|
else
|
129
|
-
|
117
|
+
identifier = object.tzid rescue nil
|
118
|
+
parameters["TZID"] = identifier if identifier
|
130
119
|
end
|
120
|
+
[object, parameters]
|
131
121
|
end
|
132
122
|
|
133
123
|
|
134
124
|
def self.convert(timezone_finder, ruby_object) # :nodoc:
|
135
|
-
|
136
|
-
end
|
137
|
-
|
138
|
-
# Create an instance of RiCal::PropertyValue::DateTime representing a Ruby Time or DateTime
|
139
|
-
# If the ruby object has been extended by ActiveSupport to have a time_zone method, then
|
140
|
-
# the timezone will be used as the TZID parameter.
|
141
|
-
#
|
142
|
-
# Otherwise the class level default tzid will be used.
|
143
|
-
# == See
|
144
|
-
# * RiCal::PropertyValue::DateTime.default_tzid
|
145
|
-
# * RiCal::PropertyValue::DateTime#object_time_zone
|
146
|
-
def self.from_time(time_or_date_time)
|
147
|
-
convert_with_tzid_or_nil(nil, time_or_date_time) ||
|
148
|
-
new(nil, :value => time_or_date_time.strftime("%Y%m%dT%H%M%S"), :params => default_tzid_hash)
|
149
|
-
end
|
150
|
-
|
151
|
-
def self.convert_with_tzid_or_nil(timezone_finder, ruby_object) # :nodoc:
|
152
|
-
time, identifier = *self.time_and_tzid(ruby_object)
|
153
|
-
if identifier
|
154
|
-
new(
|
155
|
-
timezone_finder,
|
156
|
-
:params => params_for_tzid(identifier),
|
157
|
-
:value => time.strftime("%Y%m%d%H%M%S")
|
158
|
-
)
|
159
|
-
else
|
160
|
-
nil
|
161
|
-
end
|
125
|
+
ruby_object.to_ri_cal_date_or_date_time_value(timezone_finder)
|
162
126
|
end
|
163
127
|
|
164
128
|
def self.from_string(string) # :nodoc:
|
@@ -192,10 +156,22 @@ module RiCal
|
|
192
156
|
|
193
157
|
def params=(value) #:nodoc:
|
194
158
|
@params = value.dup
|
195
|
-
if params_timezone = params['TZID']
|
196
|
-
|
159
|
+
if params_timezone = @params['TZID']
|
160
|
+
self.tzid = @params['TZID']
|
197
161
|
end
|
198
162
|
end
|
163
|
+
|
164
|
+
# Return a Hash representing this properties parameters
|
165
|
+
def params
|
166
|
+
result = @params.dup
|
167
|
+
case tzid
|
168
|
+
when :floating, nil, "UTC"
|
169
|
+
result.delete('TZID')
|
170
|
+
else
|
171
|
+
result['TZID'] = tzid
|
172
|
+
end
|
173
|
+
result
|
174
|
+
end
|
199
175
|
|
200
176
|
# Compare the receiver with another object which must respond to the to_datetime message
|
201
177
|
# The comparison is done using the Ruby DateTime representations of the two objects
|
@@ -208,11 +184,11 @@ module RiCal
|
|
208
184
|
[other.year, other.month] == [year, month]
|
209
185
|
end
|
210
186
|
|
211
|
-
def nth_wday_in_month(n, which_wday)
|
187
|
+
def nth_wday_in_month(n, which_wday) #:nodoc:
|
212
188
|
@date_time_value.nth_wday_in_month(n, which_wday, self)
|
213
189
|
end
|
214
190
|
|
215
|
-
def nth_wday_in_year(n, which_wday)
|
191
|
+
def nth_wday_in_year(n, which_wday) #:nodoc:
|
216
192
|
@date_time_value.nth_wday_in_year(n, which_wday, self)
|
217
193
|
end
|
218
194
|
|
@@ -228,12 +204,6 @@ module RiCal
|
|
228
204
|
@date_time_value.days_in_month
|
229
205
|
end
|
230
206
|
|
231
|
-
def in_same_month_as?(other)
|
232
|
-
[other.year, other.month] == [year, month]
|
233
|
-
end
|
234
|
-
|
235
|
-
|
236
|
-
|
237
207
|
# Determine if the receiver and another object are equivalent RiCal::PropertyValue::DateTime instances
|
238
208
|
def ==(other)
|
239
209
|
if self.class === other
|
@@ -295,26 +265,26 @@ module RiCal
|
|
295
265
|
@date_time_value.iso_year_and_week_one_start(wkst)
|
296
266
|
end
|
297
267
|
|
298
|
-
def iso_weeks_in_year(wkst)
|
299
|
-
@date_time_value.iso_weeks_in_year(wkst)
|
268
|
+
def iso_weeks_in_year(wkst) #:nodoc:
|
269
|
+
@date_time_value.iso_weeks_in_year(wkst) #:nodoc:
|
300
270
|
end
|
301
271
|
|
302
272
|
# Return the "Natural' property value for the receover, in this case the receiver itself."
|
303
|
-
def to_ri_cal_date_or_date_time_value
|
304
|
-
self
|
273
|
+
def to_ri_cal_date_or_date_time_value(timezone_finder = nil) #:nodoc:
|
274
|
+
self.for_parent(timezone_finder)
|
305
275
|
end
|
306
276
|
|
307
277
|
# Return the Ruby DateTime representation of the receiver
|
308
|
-
def to_datetime
|
278
|
+
def to_datetime #:nodoc:
|
309
279
|
@date_time_value
|
310
280
|
end
|
311
281
|
|
312
282
|
# Returns a ruby DateTime object representing the receiver.
|
313
283
|
def ruby_value
|
314
|
-
|
284
|
+
::DateTime.civil(year, month, day, hour, min, sec, rational_tz_offset).set_tzid(@tzid)
|
315
285
|
end
|
316
286
|
|
317
|
-
alias_method :to_ri_cal_ruby_value, :
|
287
|
+
alias_method :to_ri_cal_ruby_value, :to_datetime
|
318
288
|
|
319
289
|
def add_date_times_to(required_timezones) #:nodoc:
|
320
290
|
required_timezones.add_datetime(self, tzid) if has_local_timezone?
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
|
-
#- ©2009 Rick DeNatale
|
4
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
3
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
5
4
|
#
|
6
5
|
# RiCal::PropertyValue::CalAddress represents an icalendar Duration property value
|
7
6
|
# which is defined in
|
@@ -14,7 +13,7 @@ module RiCal
|
|
14
13
|
|
15
14
|
def self.from_datetimes(parent, start, finish, sign='+') # :nodoc:
|
16
15
|
if start > finish
|
17
|
-
from_datetimes(finish, start, '-')
|
16
|
+
from_datetimes(self, finish, start, '-')
|
18
17
|
else
|
19
18
|
diff = finish - start
|
20
19
|
days_diff = diff.to_i
|
@@ -60,6 +59,10 @@ module RiCal
|
|
60
59
|
end
|
61
60
|
end
|
62
61
|
end
|
62
|
+
|
63
|
+
def self.valid_string?(string) #:nodoc:
|
64
|
+
string =~ /^[+-]?P((\d+)[DHMSW])+$/
|
65
|
+
end
|
63
66
|
|
64
67
|
def days # :nodoc:
|
65
68
|
@days * @sign
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
|
-
#- ©2009 Rick DeNatale
|
4
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
3
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
5
4
|
#
|
6
5
|
# RiCal::PropertyValue::CalAddress represents an icalendar Duration property value
|
7
6
|
# which is defined in
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
|
-
#- ©2009 Rick DeNatale
|
4
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
3
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
5
4
|
#
|
6
5
|
class Integer < PropertyValue # :nodoc:
|
7
6
|
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
3
|
# OccurrenceList is used to represent the value of an RDATE or EXDATE property.
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
class OccurrenceList < Array
|
7
|
+
attr_accessor :tzid #:nodoc:
|
8
|
+
|
8
9
|
class Enumerator # :nodoc:
|
9
10
|
|
10
11
|
attr_accessor :default_duration, :occurrence_list
|
@@ -26,35 +27,87 @@ module RiCal
|
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
30
|
+
|
31
|
+
def initialize(timezone_finder, options={}) # :nodoc:
|
32
|
+
super
|
33
|
+
validate_elements
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.convert(timezone_finder, *ruby_objects) # :nodoc:
|
37
|
+
# ruby_objects = [ruby_objects] unless Array === ruby_objects
|
38
|
+
source_elements = ruby_objects.inject([]) { |se, element|
|
39
|
+
if String === element
|
40
|
+
element.split(",").each {|str| se << str}
|
41
|
+
else
|
42
|
+
se << element
|
43
|
+
end
|
44
|
+
se
|
45
|
+
}
|
46
|
+
new(timezone_finder, :source_elements => source_elements )
|
47
|
+
end
|
48
|
+
|
49
|
+
def values_to_elements(values) # :nodoc:
|
50
|
+
values.map {|val| val.to_ri_cal_occurrence_list_value(self)}
|
51
|
+
end
|
29
52
|
|
53
|
+
def tzid_from_source_elements # :nodoc:
|
54
|
+
if @source_elements && String === (first_source = @source_elements.first)
|
55
|
+
probe = first_source.to_ri_cal_occurrence_list_value rescue nil
|
56
|
+
unless probe
|
57
|
+
return @source_elements.shift
|
58
|
+
end
|
59
|
+
end
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
|
63
|
+
def tzid_conflict(element_tzid) # :nodoc:
|
64
|
+
element_tzid && tzid != element_tzid
|
65
|
+
end
|
30
66
|
|
31
|
-
def
|
32
|
-
if
|
33
|
-
|
67
|
+
def validate_elements # :nodoc:
|
68
|
+
if @source_elements
|
69
|
+
self.tzid = tzid_from_source_elements
|
70
|
+
@elements = values_to_elements(@source_elements)
|
71
|
+
@value = @elements.map {|prop| prop.value}
|
34
72
|
else
|
35
|
-
|
73
|
+
@elements = values_to_elements(@value)
|
74
|
+
end
|
75
|
+
# if the tzid wasn't set by the parameters
|
76
|
+
self.tzid ||= @elements.map {|element| element.tzid}.find {|id| id}
|
77
|
+
@elements.each do |element|
|
78
|
+
raise InvalidPropertyValue.new("Mixed timezones are not allowed in an occurrence list") if tzid_conflict(element.tzid)
|
79
|
+
element.tzid = tzid
|
36
80
|
end
|
37
|
-
super(timezone_finder, values)
|
38
81
|
end
|
39
82
|
|
40
|
-
def
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
83
|
+
def has_local_timezone? # :nodoc:
|
84
|
+
tzid && tzid != 'UTC'
|
85
|
+
end
|
86
|
+
|
87
|
+
def visible_params # :nodoc:
|
88
|
+
result = params.dup
|
89
|
+
if has_local_timezone?
|
90
|
+
result['TZID'] = tzid
|
91
|
+
else
|
92
|
+
result.delete('TZID')
|
50
93
|
end
|
94
|
+
result
|
95
|
+
end
|
96
|
+
|
97
|
+
def value # :nodoc:
|
98
|
+
@elements.map {|element| element.value}.join(",")
|
99
|
+
end
|
100
|
+
|
101
|
+
# Return an array of the occurrences within the list
|
102
|
+
def ruby_value
|
103
|
+
@elements.map {|prop| prop.ruby_value}
|
51
104
|
end
|
52
105
|
end
|
53
|
-
|
54
|
-
|
55
|
-
private :elements
|
56
|
-
|
57
|
-
def for_parent(parent)
|
106
|
+
|
107
|
+
attr_accessor :elements, :source_elements #:nodoc:
|
108
|
+
private :elements, :elements=, :source_elements=, :source_elements
|
109
|
+
|
110
|
+
def for_parent(parent) #:nodoc:
|
58
111
|
if timezone_finder.nil?
|
59
112
|
@timezone_finder = parent
|
60
113
|
self
|
@@ -64,12 +117,12 @@ module RiCal
|
|
64
117
|
OccurrenceList.new(parent, :value => value)
|
65
118
|
end
|
66
119
|
end
|
67
|
-
|
120
|
+
|
68
121
|
# Return an enumerator which can produce the elements of the occurrence list
|
69
|
-
def enumerator(component)
|
122
|
+
def enumerator(component) # :nodoc:
|
70
123
|
OccurrenceList::Enumerator.new(@elements, component)
|
71
124
|
end
|
72
|
-
|
125
|
+
|
73
126
|
def add_date_times_to(required_timezones) #:nodoc:
|
74
127
|
if @elements
|
75
128
|
@elements.each do | occurrence |
|
@@ -77,6 +130,6 @@ module RiCal
|
|
77
130
|
end
|
78
131
|
end
|
79
132
|
end
|
80
|
-
|
133
|
+
|
81
134
|
end
|
82
135
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
|
-
#- ©2009 Rick DeNatale
|
4
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
3
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
5
4
|
#
|
6
5
|
# RiCal::PropertyValue::CalAddress represents an icalendar Period property value
|
7
6
|
# which is defined in
|
@@ -29,7 +28,28 @@ module RiCal
|
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
|
-
|
31
|
+
|
32
|
+
def self.valid_string?(string) # :nodoc:
|
33
|
+
return false unless string.include?("/")
|
34
|
+
starter, terminator = *string.split("/")
|
35
|
+
return false unless PropertyValue::DateTime.valid_string?(starter)
|
36
|
+
if /P/ =~ terminator
|
37
|
+
return false unless PropertyValue::Duration.valid_string?(terminator)
|
38
|
+
else
|
39
|
+
return false unless PropertyValue::DateTime.valid_string?(terminator)
|
40
|
+
end
|
41
|
+
true
|
42
|
+
end
|
43
|
+
|
44
|
+
# Nop to allow occurrence list to try to set it
|
45
|
+
def tzid=(val)#:nodoc:
|
46
|
+
end
|
47
|
+
|
48
|
+
def tzid #:nodoc:
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
|
52
|
+
def for_parent(parent) #:nodoc:
|
33
53
|
if timezone_finder.nil
|
34
54
|
@timezone_finder = parent
|
35
55
|
self
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
3
|
class RecurrenceRule < PropertyValue
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
module EnumerationSupportMethods # :nodoc:
|
8
7
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
3
|
class RecurrenceRule < PropertyValue
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
class Enumerator # :nodoc:
|
8
7
|
# base_time gets changed everytime the time is updated by the recurrence rule's frequency
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
3
|
class RecurrenceRule < PropertyValue
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
module InitializationMethods # :nodoc:
|
8
7
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
3
|
class RecurrenceRule < PropertyValue
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
class NegativeSetposEnumerator < Enumerator # :nodoc:
|
8
7
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
3
|
class RecurrenceRule < PropertyValue
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
class NumberedSpan # :nodoc:
|
8
7
|
attr_reader :source
|
@@ -35,8 +35,7 @@ module RiCal
|
|
35
35
|
date_time.change(:month => 1, :day => 1)
|
36
36
|
end
|
37
37
|
end
|
38
|
-
#- ©2009 Rick DeNatale
|
39
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
38
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
40
39
|
#
|
41
40
|
class OccurrenceIncrementer # :nodoc:
|
42
41
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
3
|
class RecurrenceRule < PropertyValue
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
# Instances of RecurringDay are used to represent values in BYDAY recurrence rule parts
|
8
7
|
#
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
3
|
class RecurrenceRule < PropertyValue
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
# Instances of RecurringMonthDay represent BYMONTHDAY parts in recurrence rules
|
8
7
|
class RecurringMonthDay < NumberedSpan # :nodoc:
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
3
|
class RecurrenceRule < PropertyValue
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
class RecurringNumberedWeek < NumberedSpan # :nodoc:
|
8
7
|
def last
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
3
|
class RecurrenceRule < PropertyValue
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
class RecurringYearDay < NumberedSpan # :nodoc:
|
8
7
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
3
|
class RecurrenceRule < PropertyValue
|
4
|
-
#- ©2009 Rick DeNatale
|
5
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
4
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
6
5
|
#
|
7
6
|
module Validations #:nodoc:
|
8
7
|
# Validate that the parameters of the reciever conform to RFC 2445
|
@@ -4,8 +4,7 @@ end
|
|
4
4
|
|
5
5
|
module RiCal
|
6
6
|
class PropertyValue
|
7
|
-
#- ©2009 Rick DeNatale
|
8
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
7
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
9
8
|
#
|
10
9
|
# RiCal::PropertyValue::RecurrenceRule represents an icalendar Recurrence Rule property value
|
11
10
|
# which is defined in
|
@@ -99,7 +98,7 @@ module RiCal
|
|
99
98
|
#
|
100
99
|
def until=(until_value)
|
101
100
|
reset_errors
|
102
|
-
@until = until_value && until_value.to_ri_cal_date_or_date_time_value
|
101
|
+
@until = until_value && until_value.to_ri_cal_date_or_date_time_value(timezone_finder)
|
103
102
|
@count = nil unless @count.nil? || @by_list_hash
|
104
103
|
end
|
105
104
|
|
@@ -119,7 +118,7 @@ module RiCal
|
|
119
118
|
@interval = interval_value
|
120
119
|
end
|
121
120
|
|
122
|
-
def value
|
121
|
+
def value #:nodoc:
|
123
122
|
@value || to_ical
|
124
123
|
end
|
125
124
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
|
-
#- ©2009 Rick DeNatale
|
4
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
3
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
5
4
|
#
|
6
5
|
# RiCal::PropertyValue::Text represents an icalendar Text property value
|
7
6
|
# which is defined in
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
|
-
#- ©2009 Rick DeNatale
|
4
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
3
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
5
4
|
#
|
6
5
|
# RiCal::PropertyValue::Uri represents an icalendar Uri property value
|
7
6
|
# which is defined in
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module RiCal
|
2
2
|
class PropertyValue
|
3
|
-
#- ©2009 Rick DeNatale
|
4
|
-
#- All rights reserved. Refer to the file README.txt for the license
|
3
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
5
4
|
#
|
6
5
|
class UtcOffset < PropertyValue # :nodoc:
|
7
6
|
attr_accessor :sign, :hours, :minutes, :seconds
|