ri_cal 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/Rakefile +59 -46
- data/VERSION +1 -0
- data/component_attributes/component_property_defs.yml +3 -3
- data/lib/ri_cal/component/t_z_info_timezone.rb +17 -3
- data/lib/ri_cal/core_extensions/date/conversions.rb +0 -14
- data/lib/ri_cal/core_extensions/date_time/conversions.rb +0 -6
- data/lib/ri_cal/fast_date_time.rb +8 -0
- data/lib/ri_cal/properties/alarm.rb +8 -8
- data/lib/ri_cal/properties/calendar.rb +3 -3
- data/lib/ri_cal/properties/event.rb +62 -65
- data/lib/ri_cal/properties/freebusy.rb +19 -20
- data/lib/ri_cal/properties/journal.rb +50 -53
- data/lib/ri_cal/properties/timezone.rb +10 -11
- data/lib/ri_cal/properties/timezone_period.rb +10 -10
- data/lib/ri_cal/properties/todo.rb +68 -71
- data/lib/ri_cal/property_value.rb +1 -0
- data/lib/ri_cal/property_value/date.rb +4 -0
- data/lib/ri_cal/property_value/date_time.rb +8 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer.rb +4 -3
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_day_incrementer.rb +5 -1
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_monthday_incrementer.rb +1 -1
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb +5 -1
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_weekno_incrementer.rb +5 -1
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/frequency_incrementer.rb +9 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/list_incrementer.rb +11 -1
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/null_sub_cycle_incrementer.rb +4 -0
- data/lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb +5 -1
- data/lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb +5 -1
- data/lib/ri_cal/property_value/zulu_date_time.rb +34 -0
- data/parked_specs/ri_cal/claudio_a_bug_spec.rb +100 -0
- data/ri_cal.gemspec +218 -21
- data/spec/ri_cal/component/event_spec.rb +17 -0
- data/spec/ri_cal/component/t_z_info_timezone_spec.rb +5 -4
- data/spec/ri_cal/fast_date_time_spec.rb +10 -0
- data/spec/ri_cal/inf_loop_spec.rb +78 -0
- data/spec/ri_cal/parser_spec.rb +3 -3
- metadata +61 -60
@@ -74,7 +74,7 @@ module RiCal
|
|
74
74
|
|
75
75
|
|
76
76
|
# return the the CREATED property
|
77
|
-
# which will be an instances of RiCal::
|
77
|
+
# which will be an instances of RiCal::PropertyValueZuluDateTime
|
78
78
|
#
|
79
79
|
# [purpose (from RFC 2445)]
|
80
80
|
# This property specifies the date and time that the calendar information was created by teh calendar user agent in the calendar store.
|
@@ -85,24 +85,24 @@ module RiCal
|
|
85
85
|
end
|
86
86
|
|
87
87
|
# set the CREATED property
|
88
|
-
# property value should be an instance of RiCal::
|
88
|
+
# property value should be an instance of RiCal::PropertyValueZuluDateTime
|
89
89
|
def created_property=(property_value)
|
90
|
-
@created_property = property_value
|
90
|
+
@created_property = property_value
|
91
91
|
end
|
92
92
|
|
93
93
|
# set the value of the CREATED property
|
94
94
|
def created=(ruby_value)
|
95
|
-
self.created_property= RiCal::PropertyValue::
|
95
|
+
self.created_property= RiCal::PropertyValue::ZuluDateTime.convert(self, ruby_value)
|
96
96
|
end
|
97
97
|
|
98
98
|
# return the value of the CREATED property
|
99
|
-
# which will be an instance of
|
99
|
+
# which will be an instance of ZuluDateTime
|
100
100
|
def created
|
101
101
|
created_property ? created_property.ruby_value : nil
|
102
102
|
end
|
103
103
|
|
104
104
|
def created_property_from_string(line) # :nodoc:
|
105
|
-
@created_property = RiCal::PropertyValue::
|
105
|
+
@created_property = RiCal::PropertyValue::ZuluDateTime.new(self, line)
|
106
106
|
end
|
107
107
|
|
108
108
|
|
@@ -140,7 +140,7 @@ module RiCal
|
|
140
140
|
|
141
141
|
|
142
142
|
# return the the DTSTAMP property
|
143
|
-
# which will be an instances of RiCal::
|
143
|
+
# which will be an instances of RiCal::PropertyValueZuluDateTime
|
144
144
|
#
|
145
145
|
# [purpose (from RFC 2445)]
|
146
146
|
# This property indicates the date/time that the instance of the iCalendar object was created.
|
@@ -151,24 +151,24 @@ module RiCal
|
|
151
151
|
end
|
152
152
|
|
153
153
|
# set the DTSTAMP property
|
154
|
-
# property value should be an instance of RiCal::
|
154
|
+
# property value should be an instance of RiCal::PropertyValueZuluDateTime
|
155
155
|
def dtstamp_property=(property_value)
|
156
|
-
@dtstamp_property = property_value
|
156
|
+
@dtstamp_property = property_value
|
157
157
|
end
|
158
158
|
|
159
159
|
# set the value of the DTSTAMP property
|
160
160
|
def dtstamp=(ruby_value)
|
161
|
-
self.dtstamp_property= RiCal::PropertyValue::
|
161
|
+
self.dtstamp_property= RiCal::PropertyValue::ZuluDateTime.convert(self, ruby_value)
|
162
162
|
end
|
163
163
|
|
164
164
|
# return the value of the DTSTAMP property
|
165
|
-
# which will be an instance of
|
165
|
+
# which will be an instance of ZuluDateTime
|
166
166
|
def dtstamp
|
167
167
|
dtstamp_property ? dtstamp_property.ruby_value : nil
|
168
168
|
end
|
169
169
|
|
170
170
|
def dtstamp_property_from_string(line) # :nodoc:
|
171
|
-
@dtstamp_property = RiCal::PropertyValue::
|
171
|
+
@dtstamp_property = RiCal::PropertyValue::ZuluDateTime.new(self, line)
|
172
172
|
end
|
173
173
|
|
174
174
|
|
@@ -239,7 +239,7 @@ module RiCal
|
|
239
239
|
|
240
240
|
|
241
241
|
# return the the LAST-MODIFIED property
|
242
|
-
# which will be an instances of RiCal::
|
242
|
+
# which will be an instances of RiCal::PropertyValueZuluDateTime
|
243
243
|
#
|
244
244
|
# [purpose (from RFC 2445)]
|
245
245
|
# This property specifies the date and time that the information associated with the calendar component was last revised in teh calendar store.
|
@@ -250,24 +250,24 @@ module RiCal
|
|
250
250
|
end
|
251
251
|
|
252
252
|
# set the LAST-MODIFIED property
|
253
|
-
# property value should be an instance of RiCal::
|
253
|
+
# property value should be an instance of RiCal::PropertyValueZuluDateTime
|
254
254
|
def last_modified_property=(property_value)
|
255
|
-
@last_modified_property = property_value
|
255
|
+
@last_modified_property = property_value
|
256
256
|
end
|
257
257
|
|
258
258
|
# set the value of the LAST-MODIFIED property
|
259
259
|
def last_modified=(ruby_value)
|
260
|
-
self.last_modified_property= RiCal::PropertyValue::
|
260
|
+
self.last_modified_property= RiCal::PropertyValue::ZuluDateTime.convert(self, ruby_value)
|
261
261
|
end
|
262
262
|
|
263
263
|
# return the value of the LAST-MODIFIED property
|
264
|
-
# which will be an instance of
|
264
|
+
# which will be an instance of ZuluDateTime
|
265
265
|
def last_modified
|
266
266
|
last_modified_property ? last_modified_property.ruby_value : nil
|
267
267
|
end
|
268
268
|
|
269
269
|
def last_modified_property_from_string(line) # :nodoc:
|
270
|
-
@last_modified_property = RiCal::PropertyValue::
|
270
|
+
@last_modified_property = RiCal::PropertyValue::ZuluDateTime.new(self, line)
|
271
271
|
end
|
272
272
|
|
273
273
|
|
@@ -1423,74 +1423,74 @@ module RiCal
|
|
1423
1423
|
end
|
1424
1424
|
|
1425
1425
|
def export_properties_to(export_stream) #:nodoc:
|
1426
|
-
export_prop_to(export_stream, "
|
1426
|
+
export_prop_to(export_stream, "RDATE", @rdate_property)
|
1427
|
+
export_prop_to(export_stream, "CONTACT", @contact_property)
|
1428
|
+
export_prop_to(export_stream, "COMPLETED", @completed_property)
|
1427
1429
|
export_prop_to(export_stream, "EXDATE", @exdate_property)
|
1428
|
-
export_prop_to(export_stream, "DTSTAMP", @dtstamp_property)
|
1429
1430
|
export_prop_to(export_stream, "CREATED", @created_property)
|
1430
|
-
export_prop_to(export_stream, "
|
1431
|
-
export_prop_to(export_stream, "CATEGORIES", @categories_property)
|
1431
|
+
export_prop_to(export_stream, "DURATION", @duration_property)
|
1432
1432
|
export_prop_to(export_stream, "STATUS", @status_property)
|
1433
|
-
export_prop_to(export_stream, "LAST-MODIFIED", @last_modified_property)
|
1434
1433
|
export_prop_to(export_stream, "DTSTART", @dtstart_property)
|
1435
|
-
export_prop_to(export_stream, "COMPLETED", @completed_property)
|
1436
1434
|
export_prop_to(export_stream, "RECURRENCE-ID", @recurrence_id_property)
|
1435
|
+
export_prop_to(export_stream, "DTSTAMP", @dtstamp_property)
|
1437
1436
|
export_prop_to(export_stream, "RESOURCES", @resources_property)
|
1438
|
-
export_prop_to(export_stream, "
|
1439
|
-
export_prop_to(export_stream, "DURATION", @duration_property)
|
1437
|
+
export_prop_to(export_stream, "CATEGORIES", @categories_property)
|
1440
1438
|
export_prop_to(export_stream, "DUE", @due_property)
|
1441
|
-
export_prop_to(export_stream, "
|
1442
|
-
export_prop_to(export_stream, "URL", @url_property)
|
1439
|
+
export_prop_to(export_stream, "LAST-MODIFIED", @last_modified_property)
|
1443
1440
|
export_prop_to(export_stream, "PRIORITY", @priority_property)
|
1444
1441
|
export_prop_to(export_stream, "PERCENT-COMPLETE", @percent_complete_property)
|
1445
|
-
export_prop_to(export_stream, "
|
1446
|
-
export_prop_to(export_stream, "
|
1442
|
+
export_prop_to(export_stream, "GEO", @geo_property)
|
1443
|
+
export_prop_to(export_stream, "ATTENDEE", @attendee_property)
|
1444
|
+
export_prop_to(export_stream, "UID", @uid_property)
|
1447
1445
|
export_prop_to(export_stream, "DESCRIPTION", @description_property)
|
1448
|
-
export_prop_to(export_stream, "
|
1446
|
+
export_prop_to(export_stream, "URL", @url_property)
|
1449
1447
|
export_prop_to(export_stream, "SUMMARY", @summary_property)
|
1450
|
-
export_prop_to(export_stream, "
|
1448
|
+
export_prop_to(export_stream, "ORGANIZER", @organizer_property)
|
1449
|
+
export_prop_to(export_stream, "RRULE", @rrule_property)
|
1451
1450
|
export_prop_to(export_stream, "ATTACH", @attach_property)
|
1452
|
-
export_prop_to(export_stream, "
|
1453
|
-
export_prop_to(export_stream, "RDATE", @rdate_property)
|
1451
|
+
export_prop_to(export_stream, "CLASS", @class_property)
|
1454
1452
|
export_prop_to(export_stream, "RELATED-TO", @related_to_property)
|
1453
|
+
export_prop_to(export_stream, "REQUEST-STATUS", @request_status_property)
|
1455
1454
|
export_prop_to(export_stream, "EXRULE", @exrule_property)
|
1456
1455
|
export_prop_to(export_stream, "LOCATION", @location_property)
|
1457
1456
|
export_prop_to(export_stream, "COMMENT", @comment_property)
|
1457
|
+
export_prop_to(export_stream, "SEQUENCE", @sequence_property)
|
1458
1458
|
end
|
1459
1459
|
|
1460
1460
|
def ==(o) #:nodoc:
|
1461
1461
|
if o.class == self.class
|
1462
|
-
(
|
1462
|
+
(rdate_property == o.rdate_property) &&
|
1463
|
+
(contact_property == o.contact_property) &&
|
1464
|
+
(completed_property == o.completed_property) &&
|
1463
1465
|
(exdate_property == o.exdate_property) &&
|
1464
|
-
(dtstamp_property == o.dtstamp_property) &&
|
1465
1466
|
(created_property == o.created_property) &&
|
1466
|
-
(
|
1467
|
-
(categories_property == o.categories_property) &&
|
1467
|
+
(duration_property == o.duration_property) &&
|
1468
1468
|
(status_property == o.status_property) &&
|
1469
|
-
(last_modified_property == o.last_modified_property) &&
|
1470
1469
|
(dtstart_property == o.dtstart_property) &&
|
1471
|
-
(completed_property == o.completed_property) &&
|
1472
1470
|
(recurrence_id_property == o.recurrence_id_property) &&
|
1471
|
+
(dtstamp_property == o.dtstamp_property) &&
|
1473
1472
|
(resources_property == o.resources_property) &&
|
1474
|
-
(
|
1475
|
-
(duration_property == o.duration_property) &&
|
1473
|
+
(categories_property == o.categories_property) &&
|
1476
1474
|
(due_property == o.due_property) &&
|
1477
|
-
(
|
1478
|
-
(url_property == o.url_property) &&
|
1475
|
+
(last_modified_property == o.last_modified_property) &&
|
1479
1476
|
(priority_property == o.priority_property) &&
|
1480
1477
|
(percent_complete_property == o.percent_complete_property) &&
|
1481
|
-
(
|
1482
|
-
(
|
1478
|
+
(geo_property == o.geo_property) &&
|
1479
|
+
(attendee_property == o.attendee_property) &&
|
1480
|
+
(uid_property == o.uid_property) &&
|
1483
1481
|
(description_property == o.description_property) &&
|
1484
|
-
(
|
1482
|
+
(url_property == o.url_property) &&
|
1485
1483
|
(summary_property == o.summary_property) &&
|
1486
|
-
(
|
1484
|
+
(organizer_property == o.organizer_property) &&
|
1485
|
+
(rrule_property == o.rrule_property) &&
|
1487
1486
|
(attach_property == o.attach_property) &&
|
1488
|
-
(
|
1489
|
-
(rdate_property == o.rdate_property) &&
|
1487
|
+
(class_property == o.class_property) &&
|
1490
1488
|
(related_to_property == o.related_to_property) &&
|
1489
|
+
(request_status_property == o.request_status_property) &&
|
1491
1490
|
(exrule_property == o.exrule_property) &&
|
1492
1491
|
(location_property == o.location_property) &&
|
1493
|
-
(comment_property == o.comment_property)
|
1492
|
+
(comment_property == o.comment_property) &&
|
1493
|
+
(sequence_property == o.sequence_property)
|
1494
1494
|
else
|
1495
1495
|
super
|
1496
1496
|
end
|
@@ -1498,45 +1498,42 @@ module RiCal
|
|
1498
1498
|
|
1499
1499
|
def initialize_copy(o) #:nodoc:
|
1500
1500
|
super
|
1501
|
-
|
1501
|
+
rdate_property = rdate_property && rdate_property.dup
|
1502
|
+
contact_property = contact_property && contact_property.dup
|
1503
|
+
completed_property = completed_property && completed_property.dup
|
1502
1504
|
exdate_property = exdate_property && exdate_property.dup
|
1503
|
-
dtstamp_property = dtstamp_property && dtstamp_property.dup
|
1504
1505
|
created_property = created_property && created_property.dup
|
1505
|
-
|
1506
|
-
categories_property = categories_property && categories_property.dup
|
1506
|
+
duration_property = duration_property && duration_property.dup
|
1507
1507
|
status_property = status_property && status_property.dup
|
1508
|
-
last_modified_property = last_modified_property && last_modified_property.dup
|
1509
1508
|
dtstart_property = dtstart_property && dtstart_property.dup
|
1510
|
-
completed_property = completed_property && completed_property.dup
|
1511
1509
|
recurrence_id_property = recurrence_id_property && recurrence_id_property.dup
|
1510
|
+
dtstamp_property = dtstamp_property && dtstamp_property.dup
|
1512
1511
|
resources_property = resources_property && resources_property.dup
|
1513
|
-
|
1514
|
-
duration_property = duration_property && duration_property.dup
|
1512
|
+
categories_property = categories_property && categories_property.dup
|
1515
1513
|
due_property = due_property && due_property.dup
|
1516
|
-
|
1517
|
-
url_property = url_property && url_property.dup
|
1514
|
+
last_modified_property = last_modified_property && last_modified_property.dup
|
1518
1515
|
priority_property = priority_property && priority_property.dup
|
1519
1516
|
percent_complete_property = percent_complete_property && percent_complete_property.dup
|
1520
|
-
|
1521
|
-
|
1517
|
+
geo_property = geo_property && geo_property.dup
|
1518
|
+
attendee_property = attendee_property && attendee_property.dup
|
1519
|
+
uid_property = uid_property && uid_property.dup
|
1522
1520
|
description_property = description_property && description_property.dup
|
1523
|
-
|
1521
|
+
url_property = url_property && url_property.dup
|
1524
1522
|
summary_property = summary_property && summary_property.dup
|
1525
|
-
|
1523
|
+
organizer_property = organizer_property && organizer_property.dup
|
1524
|
+
rrule_property = rrule_property && rrule_property.dup
|
1526
1525
|
attach_property = attach_property && attach_property.dup
|
1527
|
-
|
1528
|
-
rdate_property = rdate_property && rdate_property.dup
|
1526
|
+
class_property = class_property && class_property.dup
|
1529
1527
|
related_to_property = related_to_property && related_to_property.dup
|
1528
|
+
request_status_property = request_status_property && request_status_property.dup
|
1530
1529
|
exrule_property = exrule_property && exrule_property.dup
|
1531
1530
|
location_property = location_property && location_property.dup
|
1532
1531
|
comment_property = comment_property && comment_property.dup
|
1532
|
+
sequence_property = sequence_property && sequence_property.dup
|
1533
1533
|
end
|
1534
1534
|
|
1535
1535
|
def add_date_times_to(required_timezones) #:nodoc:
|
1536
|
-
add_property_date_times_to(required_timezones, created_property)
|
1537
|
-
add_property_date_times_to(required_timezones, dtstamp_property)
|
1538
1536
|
add_property_date_times_to(required_timezones, dtstart_property)
|
1539
|
-
add_property_date_times_to(required_timezones, last_modified_property)
|
1540
1537
|
add_property_date_times_to(required_timezones, recurrence_id_property)
|
1541
1538
|
add_property_date_times_to(required_timezones, due_property)
|
1542
1539
|
add_property_date_times_to(required_timezones, exdate_property)
|
@@ -1545,7 +1542,7 @@ module RiCal
|
|
1545
1542
|
|
1546
1543
|
module ClassMethods #:nodoc:
|
1547
1544
|
def property_parser #:nodoc:
|
1548
|
-
{"RDATE"=>:rdate_property_from_string, "
|
1545
|
+
{"RDATE"=>:rdate_property_from_string, "COMMENT"=>:comment_property_from_string, "LOCATION"=>:location_property_from_string, "CONTACT"=>:contact_property_from_string, "URL"=>:url_property_from_string, "RECURRENCE-ID"=>:recurrence_id_property_from_string, "LAST-MODIFIED"=>:last_modified_property_from_string, "COMPLETED"=>:completed_property_from_string, "CLASS"=>:class_property_from_string, "EXDATE"=>:exdate_property_from_string, "UID"=>:uid_property_from_string, "SEQUENCE"=>:sequence_property_from_string, "PERCENT-COMPLETE"=>:percent_complete_property_from_string, "EXRULE"=>:exrule_property_from_string, "ATTENDEE"=>:attendee_property_from_string, "ORGANIZER"=>:organizer_property_from_string, "GEO"=>:geo_property_from_string, "RRULE"=>:rrule_property_from_string, "RESOURCES"=>:resources_property_from_string, "ATTACH"=>:attach_property_from_string, "CATEGORIES"=>:categories_property_from_string, "SUMMARY"=>:summary_property_from_string, "PRIORITY"=>:priority_property_from_string, "DESCRIPTION"=>:description_property_from_string, "RELATED-TO"=>:related_to_property_from_string, "REQUEST-STATUS"=>:request_status_property_from_string, "DURATION"=>:duration_property_from_string, "DUE"=>:due_property_from_string, "STATUS"=>:status_property_from_string, "DTSTART"=>:dtstart_property_from_string, "DTSTAMP"=>:dtstamp_property_from_string, "CREATED"=>:created_property_from_string}
|
1549
1546
|
end
|
1550
1547
|
end
|
1551
1548
|
|
@@ -17,6 +17,7 @@ module RiCal
|
|
17
17
|
autoload :Text, "ri_cal/property_value/text.rb"
|
18
18
|
autoload :Uri, "ri_cal/property_value/uri.rb"
|
19
19
|
autoload :UtcOffset, "ri_cal/property_value/utc_offset.rb"
|
20
|
+
autoload :ZuluDateTime, "ri_cal/property_value/zulu_date_time.rb"
|
20
21
|
|
21
22
|
attr_writer :params, :value #:nodoc:
|
22
23
|
attr_reader :timezone_finder #:nodoc:
|
@@ -76,12 +76,13 @@ module RiCal
|
|
76
76
|
|
77
77
|
# Return the next time after previous_occurrence generated by this incrementer
|
78
78
|
# But the occurrence is outside the current cycle of any outer incrementer(s) return
|
79
|
-
# nil which will cause the outer incrementer to step to its next cycle
|
79
|
+
# nil which will cause the outer incrementer to step to its next cycle
|
80
80
|
def next_time(previous_occurrence)
|
81
|
+
@previous_occurrence = previous_occurrence
|
81
82
|
if current_occurrence
|
82
|
-
sub_occurrence = sub_cycle_incrementer.next_time(previous_occurrence)
|
83
|
+
sub_occurrence = @sub_cycle_incrementer.next_time(previous_occurrence)
|
83
84
|
else #first time
|
84
|
-
sub_occurrence = sub_cycle_incrementer.first_sub_occurrence(previous_occurrence, update_cycle_range(previous_occurrence))
|
85
|
+
sub_occurrence = @sub_cycle_incrementer.first_sub_occurrence(previous_occurrence, update_cycle_range(previous_occurrence))
|
85
86
|
end
|
86
87
|
if sub_occurrence
|
87
88
|
candidate = sub_occurrence
|
@@ -39,6 +39,10 @@ module RiCal
|
|
39
39
|
OccurrenceIncrementer::ByYeardayIncrementer.for_rrule(rrule)
|
40
40
|
end
|
41
41
|
end
|
42
|
+
|
43
|
+
def unneeded?(candidate)
|
44
|
+
false
|
45
|
+
end
|
42
46
|
|
43
47
|
def daily_incrementer?
|
44
48
|
true
|
@@ -60,7 +64,7 @@ module RiCal
|
|
60
64
|
result
|
61
65
|
end
|
62
66
|
|
63
|
-
def
|
67
|
+
def candidate_acceptable?(candidate)
|
64
68
|
list.any? {|recurring_day| recurring_day.include?(candidate)}
|
65
69
|
end
|
66
70
|
|
data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb
CHANGED
@@ -9,6 +9,10 @@ module RiCal
|
|
9
9
|
def daily_incrementer?
|
10
10
|
true
|
11
11
|
end
|
12
|
+
|
13
|
+
def unneeded?(candidate)
|
14
|
+
list.length == 1 && list.first.fixed_day?
|
15
|
+
end
|
12
16
|
|
13
17
|
def occurrences_for(date_time)
|
14
18
|
if occurrences && @scoping_value == scope_of(date_time)
|
@@ -24,7 +28,7 @@ module RiCal
|
|
24
28
|
date_time.end_of_day
|
25
29
|
end
|
26
30
|
|
27
|
-
def
|
31
|
+
def candidate_acceptable?(candidate)
|
28
32
|
list.any? {|by_part| by_part.include?(candidate)}
|
29
33
|
end
|
30
34
|
end
|
data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_weekno_incrementer.rb
CHANGED
@@ -20,6 +20,10 @@ module RiCal
|
|
20
20
|
def weeknum_incrementer?
|
21
21
|
true
|
22
22
|
end
|
23
|
+
|
24
|
+
def unneeded?(candidate)
|
25
|
+
false
|
26
|
+
end
|
23
27
|
|
24
28
|
def first_within_outer_cycle(previous_occurrence, outer_range)
|
25
29
|
new_range_start = outer_range.first
|
@@ -47,7 +51,7 @@ module RiCal
|
|
47
51
|
weeks.map {|wk_num| week_one_occurrence.advance(:days => (wk_num - 1) * 7)}
|
48
52
|
end
|
49
53
|
|
50
|
-
def
|
54
|
+
def candidate_acceptable?(candidate)
|
51
55
|
list.include?(candidate.iso_week_num(wkst))
|
52
56
|
end
|
53
57
|
|
data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/frequency_incrementer.rb
CHANGED
@@ -33,6 +33,14 @@ module RiCal
|
|
33
33
|
def step(occurrence)
|
34
34
|
occurrence.advance(advance_what => (interval * multiplier))
|
35
35
|
end
|
36
|
+
|
37
|
+
def sub_cycle_incrementer
|
38
|
+
if @sub_cycle_incrementer.unneeded?(current_occurrence || @previous_occurrence)
|
39
|
+
NullSubCycleIncrementer
|
40
|
+
else
|
41
|
+
super
|
42
|
+
end
|
43
|
+
end
|
36
44
|
|
37
45
|
def first_within_outer_cycle(previous_occurrence, outer_cycle_range)
|
38
46
|
if outer_range
|
@@ -46,6 +54,7 @@ module RiCal
|
|
46
54
|
|
47
55
|
# Advance to the next occurrence, if the result is within the current cycles of all outer incrementers
|
48
56
|
def next_cycle(previous_occurrence)
|
57
|
+
@sub_cycle_dtstart = previous_occurrence
|
49
58
|
if current_occurrence
|
50
59
|
candidate = sub_cycle_incrementer.cycle_adjust(step(current_occurrence))
|
51
60
|
else
|
@@ -40,6 +40,16 @@ module RiCal
|
|
40
40
|
nil
|
41
41
|
end
|
42
42
|
end
|
43
|
+
|
44
|
+
def unneeded?(candidate)
|
45
|
+
sub_cycle_incrementer.unneeded?(candidate) &&
|
46
|
+
list.length == 1 &&
|
47
|
+
candidate_acceptable?(candidate)
|
48
|
+
end
|
49
|
+
|
50
|
+
def candidate_acceptable?(candidate)
|
51
|
+
list.any? {|value| candidate.send(varying_time_attribute) == value}
|
52
|
+
end
|
43
53
|
|
44
54
|
def first_within_outer_cycle(previous_occurrence, outer_range)
|
45
55
|
self.outer_range = outer_range
|
@@ -47,7 +57,7 @@ module RiCal
|
|
47
57
|
occurrences.each { |occurrence|
|
48
58
|
sub = sub_cycle_incrementer.first_within_outer_cycle(previous_occurrence, update_cycle_range(occurrence))
|
49
59
|
return sub if sub && sub > previous_occurrence
|
50
|
-
|
60
|
+
}
|
51
61
|
nil
|
52
62
|
end
|
53
63
|
|