rubyredrick-ri_cal 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -50,6 +50,7 @@ lib/ri_cal/floating_timezone.rb
50
50
  lib/ri_cal/invalid_property_value.rb
51
51
  lib/ri_cal/invalid_timezone_identifer.rb
52
52
  lib/ri_cal/occurrence_enumerator.rb
53
+ lib/ri_cal/occurrence_period.rb
53
54
  lib/ri_cal/parser.rb
54
55
  lib/ri_cal/properties/alarm.rb
55
56
  lib/ri_cal/properties/calendar.rb
@@ -56,7 +56,7 @@ module RiCal
56
56
  end
57
57
 
58
58
  # return the earliest of each of the enumerators next occurrences
59
- def next_occurrence
59
+ def next_occurrence
60
60
  result = nexts.compact.sort.first
61
61
  if result
62
62
  nexts.each_with_index { |datetimevalue, i| @nexts[i] = @enumerators[i].next_occurrence if result == datetimevalue }
@@ -85,7 +85,7 @@ module RiCal
85
85
  # return the next exclusion which starts at the same time or after the start time of the occurrence
86
86
  # return nil if this exhausts the exclusion rules
87
87
  def exclusion_for(occurrence)
88
- while (@next_exclusion && @next_exclusion[:start] < occurrence[:start])
88
+ while (@next_exclusion && @next_exclusion.dtstart < occurrence.dtstart)
89
89
  @next_exclusion = @exrules.next_occurrence
90
90
  end
91
91
  @next_exclusion
@@ -94,13 +94,13 @@ module RiCal
94
94
  # TODO: Need to research this, I beleive that this should also take the end time into account,
95
95
  # but I need to research
96
96
  def exclusion_match?(occurrence, exclusion)
97
- exclusion && occurrence[:start] == exclusion[:start]
97
+ exclusion && (occurrence.dtstart == exclusion.dtstart)
98
98
  end
99
99
 
100
100
  # Also exclude occurrences before the :starting date_time
101
101
  def exclude?(occurrence)
102
102
  exclusion_match?(occurrence, exclusion_for(occurrence)) ||
103
- (@start && occurrence[:start].to_datetime < @start)
103
+ (@start && occurrence.dtstart.to_datetime < @start)
104
104
  end
105
105
 
106
106
  # yield each occurrence to a block
@@ -113,7 +113,7 @@ module RiCal
113
113
  yielded = 0
114
114
  @next_exclusion = @exrules.next_occurrence
115
115
  while (occurrence)
116
- if (@cutoff && occurrence[:start].to_datetime >= @cutoff) || (@count && yielded >= @count)
116
+ if (@cutoff && occurrence.dtstart.to_datetime >= @cutoff) || (@count && yielded >= @count)
117
117
  occurrence = nil
118
118
  else
119
119
  unless exclude?(occurrence)
@@ -165,8 +165,8 @@ module RiCal
165
165
  end
166
166
  #
167
167
  def set_occurrence_properties!(occurrence) # :nodoc:
168
- occurrence_end = occurrence[:end]
169
- occurrence_start = occurrence[:start]
168
+ occurrence_end = occurrence.dtend
169
+ occurrence_start = occurrence.dtstart
170
170
  @rrule_property = nil
171
171
  @exrule_property = nil
172
172
  @rdate_property = nil
@@ -0,0 +1,17 @@
1
+ module RiCal
2
+ class OccurrencePeriod
3
+ attr_reader :dtstart, :dtend
4
+ def initialize(dtstart, dtend)
5
+ @dtstart = dtstart
6
+ @dtend = dtend
7
+ end
8
+
9
+ def to_s
10
+ "op:#{dtstart}-#{dtend}"
11
+ end
12
+
13
+ def <=>(other)
14
+ [dtstart, dtend] <=> [other.dtstart, other.dtend]
15
+ end
16
+ end
17
+ end
@@ -121,7 +121,7 @@ module RiCal
121
121
  def -(other)
122
122
  other.subtract_from_date_time_value(to_ri_cal_date_time_value)
123
123
  end
124
-
124
+
125
125
  def subtract_from_date_time_value(date_time)
126
126
  to_ri_cal_date_time_value.subtract_from_date_time_value(date_time)
127
127
  end
@@ -142,11 +142,9 @@ module RiCal
142
142
  end
143
143
 
144
144
  # TODO: consider if this should be a period rather than a hash
145
- def occurrence_hash(default_duration) #:nodoc:
145
+ def occurrence_period(default_duration) #:nodoc:
146
146
  date_time = self.to_ri_cal_date_time_value
147
- {:start => date_time,
148
- :end => date_time.advance(:hours => 24, :seconds => -1)}
149
- end
147
+ RiCal::OccurrencePeriod.new(date_time, date_time.advance(:hours => 24, :seconds => -1))
150
148
  end
151
149
 
152
150
  def start_of_day?
@@ -161,4 +159,5 @@ module RiCal
161
159
  end
162
160
  end
163
161
  end
164
- end
162
+ end
163
+ end
@@ -210,8 +210,8 @@ module RiCal
210
210
  end
211
211
 
212
212
  # TODO: consider if this should be a period rather than a hash
213
- def occurrence_hash(default_duration) # :nodoc:
214
- {:start => self, :end => (default_duration ? self + default_duration : nil)}
213
+ def occurrence_period(default_duration) # :nodoc:
214
+ RiCal::OccurrencePeriod.new(self, (default_duration ? self + default_duration : nil))
215
215
  end
216
216
 
217
217
  # Return the year (including the century)
@@ -27,7 +27,7 @@ module RiCal
27
27
 
28
28
  def next_occurrence
29
29
  if @index < occurrence_list.length
30
- result = occurrence_list[@index].occurrence_hash(default_duration)
30
+ result = occurrence_list[@index].occurrence_period(default_duration)
31
31
  @index += 1
32
32
  result
33
33
  else
@@ -79,6 +79,7 @@ module RiCal
79
79
  @value = @elements.map {|prop| prop.value}
80
80
  else
81
81
  @elements = values_to_elements(@value)
82
+ self.tzid = params['TZID']
82
83
  end
83
84
  # if the tzid wasn't set by the parameters
84
85
  self.tzid ||= @elements.map {|element| element.tzid}.find {|id| id}
@@ -69,9 +69,8 @@ module RiCal
69
69
  self
70
70
  end
71
71
 
72
- # TODO: consider if this should be a period rather than a hash
73
- def occurrence_hash(default_duration) #:nodoc:
74
- {:start => self, :end => (default_duration ? self + default_duration : nil)}
72
+ def occurrence_period(default_duration) #:nodoc:
73
+ RiCal::OccurrencePeriod.new(self, (default_duration ? self + default_duration : nil))
75
74
  end
76
75
 
77
76
  def add_date_times_to(required_timezones) #:nodoc:
@@ -36,8 +36,8 @@ module RiCal
36
36
  @bounded
37
37
  end
38
38
 
39
- def result_hash(date_time_value)
40
- {:start => date_time_value, :end => nil}
39
+ def result_occurrence_period(date_time_value)
40
+ RiCal::OccurrencePeriod.new(date_time_value, nil)
41
41
  end
42
42
 
43
43
  def result_passes_setpos_filter?(result)
@@ -69,7 +69,7 @@ module RiCal
69
69
  self.next_time = @incrementer.next_time(result)
70
70
  if result_passes_filters?(result)
71
71
  @count += 1
72
- return recurrence_rule.exhausted?(@count, result) ? nil : result_hash(result)
72
+ return recurrence_rule.exhausted?(@count, result) ? nil : result_occurrence_period(result)
73
73
  end
74
74
  end
75
75
  end
@@ -16,7 +16,7 @@ module RiCal
16
16
  result = advance
17
17
  if result >= start_time
18
18
  @count += 1
19
- return recurrence_rule.exhausted?(@count, result) ? nil : result_hash(result)
19
+ return recurrence_rule.exhausted?(@count, result) ? nil : result_occurrence_period(result)
20
20
  end
21
21
  end
22
22
  end
@@ -26,9 +26,9 @@ module RiCal
26
26
  end
27
27
 
28
28
  def self.convert(parent, string) #:nodoc:
29
- ical_str = string.gsub(/\n|,|;/) {|match|
30
- if match == "\n"
31
- '\n'
29
+ ical_str = string.gsub(/\n\r?|\r\n?|,|;|\\/) {|match|
30
+ if ["\n", "\r", "\n\r", "\r\n"].include?(match)
31
+ '\\n'
32
32
  else
33
33
  "\\#{match}"
34
34
  end
data/lib/ri_cal.rb CHANGED
@@ -11,7 +11,7 @@ module RiCal
11
11
  autoload :OccurrenceEnumerator, "#{my_dir}/ri_cal/occurrence_enumerator.rb"
12
12
 
13
13
  # :stopdoc:
14
- VERSION = '0.0.10'
14
+ VERSION = '0.0.11'
15
15
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
16
16
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
17
17
 
data/ri_cal.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ri_cal}
5
- s.version = "0.0.10"
5
+ s.version = "0.0.11"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["author=Rick DeNatale"]
9
- s.date = %q{2009-05-21}
9
+ s.date = %q{2009-05-23}
10
10
  s.default_executable = %q{ri_cal}
11
11
  s.description = %q{This is an UNOFFICIAL version. The public official version will be released on RubyForge. Github will be used
12
12
  for interim versions. USE THIS VERSION AT YOUR OWN RISK.
@@ -22,7 +22,7 @@ A Google group for discussion of this library has been set up http://groups.goog
22
22
  s.email = ["rick.denatale@gmail.com"]
23
23
  s.executables = ["ri_cal"]
24
24
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt", "copyrights.txt", "docs/draft-ietf-calsify-2446bis-08.txt", "docs/draft-ietf-calsify-rfc2445bis-09.txt", "docs/incrementers.txt"]
25
- s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/ri_cal", "component_attributes/alarm.yml", "component_attributes/calendar.yml", "component_attributes/component_property_defs.yml", "component_attributes/event.yml", "component_attributes/freebusy.yml", "component_attributes/journal.yml", "component_attributes/timezone.yml", "component_attributes/timezone_period.yml", "component_attributes/todo.yml", "copyrights.txt", "docs/draft-ietf-calsify-2446bis-08.txt", "docs/draft-ietf-calsify-rfc2445bis-09.txt", "docs/incrementers.txt", "docs/rfc2445.pdf", "lib/ri_cal.rb", "lib/ri_cal/component.rb", "lib/ri_cal/component/alarm.rb", "lib/ri_cal/component/calendar.rb", "lib/ri_cal/component/event.rb", "lib/ri_cal/component/freebusy.rb", "lib/ri_cal/component/journal.rb", "lib/ri_cal/component/t_z_info_timezone.rb", "lib/ri_cal/component/timezone.rb", "lib/ri_cal/component/timezone/daylight_period.rb", "lib/ri_cal/component/timezone/standard_period.rb", "lib/ri_cal/component/timezone/timezone_period.rb", "lib/ri_cal/component/todo.rb", "lib/ri_cal/core_extensions.rb", "lib/ri_cal/core_extensions/array.rb", "lib/ri_cal/core_extensions/array/conversions.rb", "lib/ri_cal/core_extensions/date.rb", "lib/ri_cal/core_extensions/date/conversions.rb", "lib/ri_cal/core_extensions/date_time.rb", "lib/ri_cal/core_extensions/date_time/conversions.rb", "lib/ri_cal/core_extensions/object.rb", "lib/ri_cal/core_extensions/object/conversions.rb", "lib/ri_cal/core_extensions/string.rb", "lib/ri_cal/core_extensions/string/conversions.rb", "lib/ri_cal/core_extensions/time.rb", "lib/ri_cal/core_extensions/time/calculations.rb", "lib/ri_cal/core_extensions/time/conversions.rb", "lib/ri_cal/core_extensions/time/tzid_access.rb", "lib/ri_cal/core_extensions/time/week_day_predicates.rb", "lib/ri_cal/floating_timezone.rb", "lib/ri_cal/invalid_property_value.rb", "lib/ri_cal/invalid_timezone_identifer.rb", "lib/ri_cal/occurrence_enumerator.rb", "lib/ri_cal/parser.rb", "lib/ri_cal/properties/alarm.rb", "lib/ri_cal/properties/calendar.rb", "lib/ri_cal/properties/event.rb", "lib/ri_cal/properties/freebusy.rb", "lib/ri_cal/properties/journal.rb", "lib/ri_cal/properties/timezone.rb", "lib/ri_cal/properties/timezone_period.rb", "lib/ri_cal/properties/todo.rb", "lib/ri_cal/property_value.rb", "lib/ri_cal/property_value/array.rb", "lib/ri_cal/property_value/cal_address.rb", "lib/ri_cal/property_value/date.rb", "lib/ri_cal/property_value/date_time.rb", "lib/ri_cal/property_value/date_time/additive_methods.rb", "lib/ri_cal/property_value/date_time/time_machine.rb", "lib/ri_cal/property_value/date_time/timezone_support.rb", "lib/ri_cal/property_value/duration.rb", "lib/ri_cal/property_value/geo.rb", "lib/ri_cal/property_value/integer.rb", "lib/ri_cal/property_value/occurrence_list.rb", "lib/ri_cal/property_value/period.rb", "lib/ri_cal/property_value/recurrence_rule.rb", "lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb", "lib/ri_cal/property_value/recurrence_rule/enumerator.rb", "lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb", "lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb", "lib/ri_cal/property_value/recurrence_rule/numbered_span.rb", "lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb", "lib/ri_cal/property_value/recurrence_rule/recurring_day.rb", "lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb", "lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb", "lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb", "lib/ri_cal/property_value/recurrence_rule/validations.rb", "lib/ri_cal/property_value/text.rb", "lib/ri_cal/property_value/uri.rb", "lib/ri_cal/property_value/utc_offset.rb", "lib/ri_cal/required_timezones.rb", "ri_cal.gemspec", "sample_ical_files/from_ical_dot_app/test1.ics", "script/console", "script/destroy", "script/generate", "script/txt2html", "spec/ri_cal/component/alarm_spec.rb", "spec/ri_cal/component/calendar_spec.rb", "spec/ri_cal/component/event_spec.rb", "spec/ri_cal/component/freebusy_spec.rb", "spec/ri_cal/component/journal_spec.rb", "spec/ri_cal/component/t_z_info_timezone_spec.rb", "spec/ri_cal/component/timezone_spec.rb", "spec/ri_cal/component/todo_spec.rb", "spec/ri_cal/component_spec.rb", "spec/ri_cal/core_extensions/string/conversions_spec.rb", "spec/ri_cal/core_extensions/time/calculations_spec.rb", "spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb", "spec/ri_cal/occurrence_enumerator_spec.rb", "spec/ri_cal/parser_spec.rb", "spec/ri_cal/property_value/date_spec.rb", "spec/ri_cal/property_value/date_time_spec.rb", "spec/ri_cal/property_value/duration_spec.rb", "spec/ri_cal/property_value/occurrence_list_spec.rb", "spec/ri_cal/property_value/period_spec.rb", "spec/ri_cal/property_value/recurrence_rule/recurring_year_day_spec.rb", "spec/ri_cal/property_value/recurrence_rule_spec.rb", "spec/ri_cal/property_value/text_spec.rb", "spec/ri_cal/property_value/utc_offset_spec.rb", "spec/ri_cal/property_value_spec.rb", "spec/ri_cal/required_timezones_spec.rb", "spec/ri_cal_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/gem_loader/load_active_support.rb", "tasks/gem_loader/load_tzinfo_gem.rb", "tasks/ri_cal.rake", "tasks/spec.rake"]
25
+ s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/ri_cal", "component_attributes/alarm.yml", "component_attributes/calendar.yml", "component_attributes/component_property_defs.yml", "component_attributes/event.yml", "component_attributes/freebusy.yml", "component_attributes/journal.yml", "component_attributes/timezone.yml", "component_attributes/timezone_period.yml", "component_attributes/todo.yml", "copyrights.txt", "docs/draft-ietf-calsify-2446bis-08.txt", "docs/draft-ietf-calsify-rfc2445bis-09.txt", "docs/incrementers.txt", "docs/rfc2445.pdf", "lib/ri_cal.rb", "lib/ri_cal/component.rb", "lib/ri_cal/component/alarm.rb", "lib/ri_cal/component/calendar.rb", "lib/ri_cal/component/event.rb", "lib/ri_cal/component/freebusy.rb", "lib/ri_cal/component/journal.rb", "lib/ri_cal/component/t_z_info_timezone.rb", "lib/ri_cal/component/timezone.rb", "lib/ri_cal/component/timezone/daylight_period.rb", "lib/ri_cal/component/timezone/standard_period.rb", "lib/ri_cal/component/timezone/timezone_period.rb", "lib/ri_cal/component/todo.rb", "lib/ri_cal/core_extensions.rb", "lib/ri_cal/core_extensions/array.rb", "lib/ri_cal/core_extensions/array/conversions.rb", "lib/ri_cal/core_extensions/date.rb", "lib/ri_cal/core_extensions/date/conversions.rb", "lib/ri_cal/core_extensions/date_time.rb", "lib/ri_cal/core_extensions/date_time/conversions.rb", "lib/ri_cal/core_extensions/object.rb", "lib/ri_cal/core_extensions/object/conversions.rb", "lib/ri_cal/core_extensions/string.rb", "lib/ri_cal/core_extensions/string/conversions.rb", "lib/ri_cal/core_extensions/time.rb", "lib/ri_cal/core_extensions/time/calculations.rb", "lib/ri_cal/core_extensions/time/conversions.rb", "lib/ri_cal/core_extensions/time/tzid_access.rb", "lib/ri_cal/core_extensions/time/week_day_predicates.rb", "lib/ri_cal/floating_timezone.rb", "lib/ri_cal/invalid_property_value.rb", "lib/ri_cal/invalid_timezone_identifer.rb", "lib/ri_cal/occurrence_enumerator.rb", "lib/ri_cal/occurrence_period.rb", "lib/ri_cal/parser.rb", "lib/ri_cal/properties/alarm.rb", "lib/ri_cal/properties/calendar.rb", "lib/ri_cal/properties/event.rb", "lib/ri_cal/properties/freebusy.rb", "lib/ri_cal/properties/journal.rb", "lib/ri_cal/properties/timezone.rb", "lib/ri_cal/properties/timezone_period.rb", "lib/ri_cal/properties/todo.rb", "lib/ri_cal/property_value.rb", "lib/ri_cal/property_value/array.rb", "lib/ri_cal/property_value/cal_address.rb", "lib/ri_cal/property_value/date.rb", "lib/ri_cal/property_value/date_time.rb", "lib/ri_cal/property_value/date_time/additive_methods.rb", "lib/ri_cal/property_value/date_time/time_machine.rb", "lib/ri_cal/property_value/date_time/timezone_support.rb", "lib/ri_cal/property_value/duration.rb", "lib/ri_cal/property_value/geo.rb", "lib/ri_cal/property_value/integer.rb", "lib/ri_cal/property_value/occurrence_list.rb", "lib/ri_cal/property_value/period.rb", "lib/ri_cal/property_value/recurrence_rule.rb", "lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb", "lib/ri_cal/property_value/recurrence_rule/enumerator.rb", "lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb", "lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb", "lib/ri_cal/property_value/recurrence_rule/numbered_span.rb", "lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb", "lib/ri_cal/property_value/recurrence_rule/recurring_day.rb", "lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb", "lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb", "lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb", "lib/ri_cal/property_value/recurrence_rule/validations.rb", "lib/ri_cal/property_value/text.rb", "lib/ri_cal/property_value/uri.rb", "lib/ri_cal/property_value/utc_offset.rb", "lib/ri_cal/required_timezones.rb", "ri_cal.gemspec", "sample_ical_files/from_ical_dot_app/test1.ics", "script/console", "script/destroy", "script/generate", "script/txt2html", "spec/ri_cal/component/alarm_spec.rb", "spec/ri_cal/component/calendar_spec.rb", "spec/ri_cal/component/event_spec.rb", "spec/ri_cal/component/freebusy_spec.rb", "spec/ri_cal/component/journal_spec.rb", "spec/ri_cal/component/t_z_info_timezone_spec.rb", "spec/ri_cal/component/timezone_spec.rb", "spec/ri_cal/component/todo_spec.rb", "spec/ri_cal/component_spec.rb", "spec/ri_cal/core_extensions/string/conversions_spec.rb", "spec/ri_cal/core_extensions/time/calculations_spec.rb", "spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb", "spec/ri_cal/occurrence_enumerator_spec.rb", "spec/ri_cal/parser_spec.rb", "spec/ri_cal/property_value/date_spec.rb", "spec/ri_cal/property_value/date_time_spec.rb", "spec/ri_cal/property_value/duration_spec.rb", "spec/ri_cal/property_value/occurrence_list_spec.rb", "spec/ri_cal/property_value/period_spec.rb", "spec/ri_cal/property_value/recurrence_rule/recurring_year_day_spec.rb", "spec/ri_cal/property_value/recurrence_rule_spec.rb", "spec/ri_cal/property_value/text_spec.rb", "spec/ri_cal/property_value/utc_offset_spec.rb", "spec/ri_cal/property_value_spec.rb", "spec/ri_cal/required_timezones_spec.rb", "spec/ri_cal_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/gem_loader/load_active_support.rb", "tasks/gem_loader/load_tzinfo_gem.rb", "tasks/ri_cal.rake", "tasks/spec.rake"]
26
26
  s.has_rdoc = true
27
27
  s.homepage = %q{http://rical.rubyforge.org/}
28
28
  s.rdoc_options = ["--main", "README.txt"]
@@ -310,12 +310,12 @@ describe RiCal::Component::Event do
310
310
  unfold(@it.export).should match(/^DTSTART;VALUE=DATE:20090422$/)
311
311
  end
312
312
 
313
- it "should properly fold on export" do
314
- @it.description = "Weather report looks nice, 80 degrees and partly cloudy, so following Michael's suggestion, let's meet at the food court at Crossroads:\n\nhttp://www.shopcrossroadsplaza.c...\n"
313
+ it "should properly fold on export when the description contains a carriage return" do
314
+ @it.description = "Weather report looks nice, 80 degrees and partly cloudy, so following Michael's suggestion, let's meet at the food court at Crossroads:\n\rhttp://www.shopcrossroadsplaza.c...\n"
315
315
  export_string = @it.export
316
316
  export_string.should match(%r(^DESCRIPTION:Weather report looks nice\\, 80 degrees and partly cloudy\\, so$))
317
317
  export_string.should match(%r(^ following Michael's suggestion\\, let's meet at the food court at Crossr$))
318
- export_string.should match(%r(^ oads:\\n\\nhttp://www.shopcrossroadsplaza\.c\.\.\.\\n$))
318
+ export_string.should match(%r(^ oads:\\nhttp://www\.shopcrossroadsplaza.c\.\.\.\\n$))
319
319
  end
320
320
  end
321
321
 
@@ -451,5 +451,61 @@ ENDCAL
451
451
  @event.should be_bounded
452
452
  end
453
453
  end
454
+
455
+ context "EXDATES with timezones bug" do
456
+ before(:each) do
457
+ cals = RiCal.parse_string rectify_ical <<-ENDCAL
458
+ BEGIN:VCALENDAR
459
+ METHOD:PUBLISH
460
+ PRODID:-//Apple Inc.//iCal 3.0//EN
461
+ CALSCALE:GREGORIAN
462
+ X-WR-CALNAME:Utah Cycling
463
+ X-WR-RELCALID:BF579011-36BF-49C6-8C7D-E96F03DE8055
464
+ VERSION:2.0
465
+ X-WR-TIMEZONE:US/Mountain
466
+ BEGIN:VTIMEZONE
467
+ TZID:US/Mountain
468
+ BEGIN:DAYLIGHT
469
+ TZOFFSETFROM:-0700
470
+ TZOFFSETTO:-0600
471
+ DTSTART:20070311T020000
472
+ RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
473
+ TZNAME:MDT
474
+ END:DAYLIGHT
475
+ BEGIN:STANDARD
476
+ TZOFFSETFROM:-0600
477
+ TZOFFSETTO:-0700
478
+ DTSTART:20071104T020000
479
+ RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
480
+ TZNAME:MST
481
+ END:STANDARD
482
+ END:VTIMEZONE
483
+ BEGIN:VEVENT
484
+ SEQUENCE:11
485
+ TRANSP:OPAQUE
486
+ UID:15208112-E0FA-4A7C-954C-CFDF19D1B0E7
487
+ DTSTART;TZID=US/Mountain:20090114T163000
488
+ DTSTAMP:20090107T024340Z
489
+ SUMMARY:Wild Rose XC/Skate Training Series
490
+ EXDATE;TZID=US/Mountain:20090114T163000
491
+ EXDATE;TZID=US/Mountain:20090128T163000
492
+ EXDATE;TZID=US/Mountain:20090121T163000
493
+ EXDATE;TZID=US/Mountain:20090211T163000
494
+ EXDATE;TZID=US/Mountain:20090204T163000
495
+ EXDATE;TZID=US/Mountain:20090218T163000
496
+ CREATED:20090107T024012Z
497
+ DTEND;TZID=US/Mountain:20090114T180000
498
+ LOCATION:Mountain Dell Golf Course
499
+ RRULE:FREQ=WEEKLY;INTERVAL=1;UNTIL=20090219T065959Z
500
+ END:VEVENT
501
+ END:VCALENDAR
502
+ ENDCAL
503
+ @event = cals.first.events.first
504
+ end
505
+
506
+ it "should have no occurrences" do
507
+ @event.occurrences.length.should == 0
508
+ end
509
+ end
454
510
 
455
511
  end
@@ -432,7 +432,7 @@ describe RiCal::PropertyValue::RecurrenceRule do
432
432
  (0..(iterations-1)).each do |i|
433
433
  occurrence = @enum.next_occurrence
434
434
  break if occurrence.nil?
435
- actuals << occurrence[:start]
435
+ actuals << occurrence.dtstart
436
436
  # This is a little strange, we do this to avoid O(n*2)
437
437
  unless actuals.last == @expectations[i]
438
438
  actuals.should == @expectations[0,actuals.length]
@@ -3,11 +3,23 @@
3
3
  require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
4
4
 
5
5
  describe RiCal::PropertyValue::Text do
6
-
7
- it "should handle escapes according to RFC2445 Sec 4.3.11 p 45" do
8
- expected = "this\\ has\, \nescaped\;\n\\x characters"
9
- it = RiCal::PropertyValue::Text.new(nil, :value => 'this\\ has\, \nescaped\;\N\x characters')
10
- it.ruby_value.should == expected
6
+
7
+ context ".ruby_value" do
8
+
9
+ it "should handle escapes according to RFC2445 Sec 4.3.11 p 45" do
10
+ expected = "this\\ has\, \nescaped\;\n\\x characters"
11
+ it = RiCal::PropertyValue::Text.new(nil, :value => 'this\\ has\, \nescaped\;\N\x characters')
12
+ it.ruby_value.should == expected
13
+ end
14
+ end
15
+
16
+ context ".convert" do
17
+
18
+ it "should handle escapes according to RFC2445 Sec 4.3.11 p 45" do
19
+ expected = ':this has\, \nescaped\;\n characters\ncr\nnlcr\ncrnl'
20
+ it = RiCal::PropertyValue::Text.convert(nil, "this\ has, \nescaped;\n characters\rcr\n\rnlcr\r\ncrnl")
21
+ it.to_s.should == expected
22
+ end
11
23
  end
12
-
24
+
13
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyredrick-ri_cal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - author=Rick DeNatale
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-21 00:00:00 -07:00
12
+ date: 2009-05-23 00:00:00 -07:00
13
13
  default_executable: ri_cal
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -100,6 +100,7 @@ files:
100
100
  - lib/ri_cal/invalid_property_value.rb
101
101
  - lib/ri_cal/invalid_timezone_identifer.rb
102
102
  - lib/ri_cal/occurrence_enumerator.rb
103
+ - lib/ri_cal/occurrence_period.rb
103
104
  - lib/ri_cal/parser.rb
104
105
  - lib/ri_cal/properties/alarm.rb
105
106
  - lib/ri_cal/properties/calendar.rb