miguelbaldi-ri_cal 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. data/History.txt +156 -0
  2. data/Manifest.txt +161 -0
  3. data/README.txt +410 -0
  4. data/Rakefile +53 -0
  5. data/bin/ri_cal +8 -0
  6. data/component_attributes/alarm.yml +10 -0
  7. data/component_attributes/calendar.yml +4 -0
  8. data/component_attributes/component_property_defs.yml +180 -0
  9. data/component_attributes/event.yml +45 -0
  10. data/component_attributes/freebusy.yml +16 -0
  11. data/component_attributes/journal.yml +35 -0
  12. data/component_attributes/timezone.yml +3 -0
  13. data/component_attributes/timezone_period.yml +11 -0
  14. data/component_attributes/todo.yml +46 -0
  15. data/copyrights.txt +1 -0
  16. data/docs/draft-ietf-calsify-2446bis-08.txt +7280 -0
  17. data/docs/draft-ietf-calsify-rfc2445bis-09.txt +10416 -0
  18. data/docs/incrementers.txt +7 -0
  19. data/docs/rfc2445.pdf +0 -0
  20. data/lib/ri_cal.rb +187 -0
  21. data/lib/ri_cal/component.rb +253 -0
  22. data/lib/ri_cal/component/alarm.rb +19 -0
  23. data/lib/ri_cal/component/calendar.rb +257 -0
  24. data/lib/ri_cal/component/event.rb +58 -0
  25. data/lib/ri_cal/component/freebusy.rb +16 -0
  26. data/lib/ri_cal/component/journal.rb +27 -0
  27. data/lib/ri_cal/component/non_standard.rb +33 -0
  28. data/lib/ri_cal/component/t_z_info_timezone.rb +139 -0
  29. data/lib/ri_cal/component/timezone.rb +197 -0
  30. data/lib/ri_cal/component/timezone/daylight_period.rb +25 -0
  31. data/lib/ri_cal/component/timezone/standard_period.rb +23 -0
  32. data/lib/ri_cal/component/timezone/timezone_period.rb +76 -0
  33. data/lib/ri_cal/component/todo.rb +42 -0
  34. data/lib/ri_cal/core_extensions.rb +11 -0
  35. data/lib/ri_cal/core_extensions/array.rb +7 -0
  36. data/lib/ri_cal/core_extensions/array/conversions.rb +15 -0
  37. data/lib/ri_cal/core_extensions/date.rb +13 -0
  38. data/lib/ri_cal/core_extensions/date/conversions.rb +69 -0
  39. data/lib/ri_cal/core_extensions/date_time.rb +15 -0
  40. data/lib/ri_cal/core_extensions/date_time/conversions.rb +55 -0
  41. data/lib/ri_cal/core_extensions/object.rb +8 -0
  42. data/lib/ri_cal/core_extensions/object/conversions.rb +20 -0
  43. data/lib/ri_cal/core_extensions/string.rb +8 -0
  44. data/lib/ri_cal/core_extensions/string/conversions.rb +53 -0
  45. data/lib/ri_cal/core_extensions/time.rb +14 -0
  46. data/lib/ri_cal/core_extensions/time/calculations.rb +153 -0
  47. data/lib/ri_cal/core_extensions/time/conversions.rb +42 -0
  48. data/lib/ri_cal/core_extensions/time/tzid_access.rb +50 -0
  49. data/lib/ri_cal/core_extensions/time/week_day_predicates.rb +55 -0
  50. data/lib/ri_cal/fast_date_time.rb +226 -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.rb +12 -0
  58. data/lib/ri_cal/properties/alarm.rb +390 -0
  59. data/lib/ri_cal/properties/calendar.rb +164 -0
  60. data/lib/ri_cal/properties/event.rb +1526 -0
  61. data/lib/ri_cal/properties/freebusy.rb +594 -0
  62. data/lib/ri_cal/properties/journal.rb +1240 -0
  63. data/lib/ri_cal/properties/timezone.rb +151 -0
  64. data/lib/ri_cal/properties/timezone_period.rb +416 -0
  65. data/lib/ri_cal/properties/todo.rb +1562 -0
  66. data/lib/ri_cal/property_value.rb +159 -0
  67. data/lib/ri_cal/property_value/array.rb +27 -0
  68. data/lib/ri_cal/property_value/cal_address.rb +11 -0
  69. data/lib/ri_cal/property_value/date.rb +180 -0
  70. data/lib/ri_cal/property_value/date_time.rb +351 -0
  71. data/lib/ri_cal/property_value/date_time/additive_methods.rb +44 -0
  72. data/lib/ri_cal/property_value/date_time/time_machine.rb +159 -0
  73. data/lib/ri_cal/property_value/date_time/timezone_support.rb +100 -0
  74. data/lib/ri_cal/property_value/duration.rb +110 -0
  75. data/lib/ri_cal/property_value/geo.rb +11 -0
  76. data/lib/ri_cal/property_value/integer.rb +12 -0
  77. data/lib/ri_cal/property_value/occurrence_list.rb +144 -0
  78. data/lib/ri_cal/property_value/period.rb +86 -0
  79. data/lib/ri_cal/property_value/recurrence_rule.rb +154 -0
  80. data/lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb +100 -0
  81. data/lib/ri_cal/property_value/recurrence_rule/enumerator.rb +79 -0
  82. data/lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb +148 -0
  83. data/lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb +53 -0
  84. data/lib/ri_cal/property_value/recurrence_rule/numbered_span.rb +31 -0
  85. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer.rb +135 -0
  86. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_day_incrementer.rb +86 -0
  87. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_hour_incrementer.rb +31 -0
  88. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_minute_incrementer.rb +32 -0
  89. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_month_incrementer.rb +52 -0
  90. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_monthday_incrementer.rb +31 -0
  91. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb +38 -0
  92. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_second_incrementer.rb +32 -0
  93. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_weekno_incrementer.rb +69 -0
  94. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_yearday_incrementer.rb +31 -0
  95. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/daily_incrementer.rb +28 -0
  96. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/frequency_incrementer.rb +80 -0
  97. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/hourly_incrementer.rb +23 -0
  98. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/list_incrementer.rb +106 -0
  99. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/minutely_incrementer.rb +23 -0
  100. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/monthly_incrementer.rb +33 -0
  101. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/null_sub_cycle_incrementer.rb +43 -0
  102. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/secondly_incrementer.rb +28 -0
  103. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/weekly_incrementer.rb +37 -0
  104. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb +57 -0
  105. data/lib/ri_cal/property_value/recurrence_rule/recurring_day.rb +131 -0
  106. data/lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb +64 -0
  107. data/lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb +33 -0
  108. data/lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb +53 -0
  109. data/lib/ri_cal/property_value/recurrence_rule/time_manipulation.rb +42 -0
  110. data/lib/ri_cal/property_value/recurrence_rule/validations.rb +125 -0
  111. data/lib/ri_cal/property_value/text.rb +40 -0
  112. data/lib/ri_cal/property_value/uri.rb +11 -0
  113. data/lib/ri_cal/property_value/utc_offset.rb +33 -0
  114. data/lib/ri_cal/required_timezones.rb +55 -0
  115. data/performance/empty_propval/subject.rb +43 -0
  116. data/performance/paris_eastern/subject.rb +90 -0
  117. data/performance/penultimate_weekday/subject.rb +15 -0
  118. data/performance/psm_big_enum/ical.ics +3171 -0
  119. data/performance/psm_big_enum/subject.rb +16 -0
  120. data/performance/utah_cycling/subject.rb +55 -0
  121. data/ri_cal.gemspec +48 -0
  122. data/script/benchmark_subject +23 -0
  123. data/script/console +10 -0
  124. data/script/destroy +14 -0
  125. data/script/generate +14 -0
  126. data/script/profile_subject +29 -0
  127. data/script/txt2html +71 -0
  128. data/spec/ri_cal/bugreports_spec.rb +249 -0
  129. data/spec/ri_cal/component/alarm_spec.rb +12 -0
  130. data/spec/ri_cal/component/calendar_spec.rb +88 -0
  131. data/spec/ri_cal/component/event_spec.rb +718 -0
  132. data/spec/ri_cal/component/freebusy_spec.rb +12 -0
  133. data/spec/ri_cal/component/journal_spec.rb +37 -0
  134. data/spec/ri_cal/component/t_z_info_timezone_spec.rb +59 -0
  135. data/spec/ri_cal/component/timezone_spec.rb +236 -0
  136. data/spec/ri_cal/component/todo_spec.rb +112 -0
  137. data/spec/ri_cal/component_spec.rb +224 -0
  138. data/spec/ri_cal/core_extensions/string/conversions_spec.rb +78 -0
  139. data/spec/ri_cal/core_extensions/time/calculations_spec.rb +188 -0
  140. data/spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb +45 -0
  141. data/spec/ri_cal/fast_date_time_spec.rb +67 -0
  142. data/spec/ri_cal/occurrence_enumerator_spec.rb +611 -0
  143. data/spec/ri_cal/parser_spec.rb +337 -0
  144. data/spec/ri_cal/property_value/date_spec.rb +53 -0
  145. data/spec/ri_cal/property_value/date_time_spec.rb +383 -0
  146. data/spec/ri_cal/property_value/duration_spec.rb +126 -0
  147. data/spec/ri_cal/property_value/occurrence_list_spec.rb +72 -0
  148. data/spec/ri_cal/property_value/period_spec.rb +63 -0
  149. data/spec/ri_cal/property_value/recurrence_rule/recurring_year_day_spec.rb +21 -0
  150. data/spec/ri_cal/property_value/recurrence_rule_spec.rb +1814 -0
  151. data/spec/ri_cal/property_value/text_spec.rb +25 -0
  152. data/spec/ri_cal/property_value/utc_offset_spec.rb +48 -0
  153. data/spec/ri_cal/property_value_spec.rb +125 -0
  154. data/spec/ri_cal/required_timezones_spec.rb +67 -0
  155. data/spec/ri_cal_spec.rb +53 -0
  156. data/spec/spec.opts +4 -0
  157. data/spec/spec_helper.rb +50 -0
  158. data/tasks/gem_loader/load_active_support.rb +3 -0
  159. data/tasks/gem_loader/load_tzinfo_gem.rb +2 -0
  160. data/tasks/ri_cal.rake +412 -0
  161. data/tasks/spec.rake +102 -0
  162. metadata +260 -0
data/History.txt ADDED
@@ -0,0 +1,156 @@
1
+ === 0.8.5
2
+ Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/26
3
+ events with date parameters failing
4
+ === 0.8.4 - 18 September 2009
5
+ Refactored load structure, should now be conforming to
6
+ http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices
7
+ I did finesse the load path issue a bit as a workaround to RSpec not putting lib on $LOADPATH
8
+ the lib directory will get added to load path IF IT ISN"T ALREADY THERE
9
+
10
+ Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/25
11
+ please clean your code up to be quiet
12
+
13
+ Thanks to Ryan for such a courteous problem report.
14
+ === 0.8.3 - 18 September 2009
15
+ Released with bad gemspec
16
+ === 0.8.2 - 4 September 2009
17
+ Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/23
18
+ initialization_methodsrb-syntax
19
+ Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/24
20
+ need-to-handle-empty-property-values
21
+ === 0.8.1 - 18 August 2009
22
+ Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/21
23
+ exception-when-count-option-used-to-enumerate-non-recurring-event
24
+ === 0.8.0 - 11 August 2009
25
+
26
+ Minor Version Bump - There is a small potentially breaking change see section on treatment of X-properties below
27
+
28
+ * Unknown Components
29
+
30
+ Starting with version 0.8.0 RiCal will parse calendars and components which contain nonstandard components.
31
+
32
+ For example, there was a short-lived proposal to extend RFC2445 with a new VVENUE component which would hold structured information about the location of an event. This proposal was never accepted and was withdrawn, but there is icalendar data in the wild which contains VVENUE components.
33
+
34
+ Prior to version 0.8.0, RiCal would raise an exception if unknown component types were encountered. Starting with version 0.8.0 RiCal will 'parse' such components and create instances of NonStandard component to represent them. Since the actual format of unknown components is not known by RiCal, the NonStandard component will simply save the data lines between the BEGIN:xxx and END:xxx lines, (where xxx is the non-standard component name, e.g. VVENUE). If the calendar is re-exported the original lines will be replayed.
35
+
36
+ * Change to treatment of X-properties
37
+
38
+ RFC2445 allows 'non-standard' or experimental properties which property-names beginning with X. RiCal always supported parsing these.
39
+
40
+ The standard properties are specified as to how many times they can occur within a particular component. For singly occurring properties RiCal returns a single property object, while for properties which can occur multiple times RiCal returns an array of property objects.
41
+
42
+ While implementing NonStandard properties, I realized that X-properties were being assumed to be singly occurring. But this isn't necessarily true. So starting with 0.8.0 the X-properties are represented by an array of property objects.
43
+
44
+ THIS MAY BREAK SOME APPLICATIONS, but the adaptation should be easy.
45
+
46
+ === 0.7.7 - 6 August 2009
47
+ - No changes other than a version number bump. github seems to have failed to notice the commit of v0.7.6
48
+ and didn't build the gem. Hopefully it will notice this one.
49
+ === 0.7.6 - 6 August 2009
50
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/20
51
+ RiCal::PropertyValue::Period was returning a nil ruby value.
52
+ === 0.7.5 - 3 August 2009
53
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/19
54
+ Microsoft ical exports double quote tzid values in parameters, which caused a failure to find VTIMEZONES
55
+ This exposed an issue with parameter parsing. Did the simplest thing which could work which was to
56
+ strip the quotes. Need to BOLO for other pathological cases showing up in future, which may require
57
+ smarter parameter parsing.
58
+
59
+ === 0.7.4 - 21 July 2009
60
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/17
61
+ Problem with Alarm trigger property value
62
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/18
63
+ Problem with exporting components with sub-components
64
+ === 0.7.3 - 13 July 2009
65
+ Added pointers to rdoc in README
66
+ === 0.7.2 - 6 July 2009
67
+ updated to use newest versions of newgem and hoe, in order to make run-code-run work again
68
+ === 0.7.1 - 6 July 2009
69
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/15
70
+ duration validation issues
71
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/16
72
+ event finish_time loses timezone info when event has a dtstart and duration
73
+ === 0.7.0 - 29 June 2009
74
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/14
75
+ component without recurrence properties should enumerate just itself only if it is within the period between starting and before
76
+ - added the :overlapping option to OccurrenceEnumerator#occurrences - Allows the enumeration of occurrences which are either partiall or completely within a timespan given by a pair of Dates/Times/DateTimes
77
+ - Fixes some Ruby 1.9 incompatibilities
78
+ - Added some new rake tasks to run specs under multi-ruby
79
+ === 0.6.3 - 14 June 2009
80
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941-ri_cal/tickets/13
81
+ tzinfotimezones-with-no-transitions-fail-on-export
82
+ === 0.6.2 - 11 June 2009
83
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941-ri_cal/tickets/12
84
+ export-failure-for-unbounded-tzinfo-timezone
85
+ === 0.6.1 - 6 June 2009
86
+ - Fixes problem with file which loads activesupport for the rake spec:with_activesupport task, it now
87
+ requires >=2.2 instead of <=2.2 - Thanks to Paul Scott-Murphy for finding this.
88
+ === 0.6.0 - 5 June 2009
89
+ Time for a minor version bump.
90
+ - Improved overall enumeration performance bypassing most of the effects of the poor performance of Ruby's DateTime class.
91
+ - Added a framework for performance monitoring during development.
92
+ - New performance directory with subdirs for code to be monitored for performance (subjects)
93
+ - New script files:
94
+ script/benchmark_subject runs a ruby benchmark on one performance subject
95
+ script/profile_subject runs ruby-prof for a subject and puts a kcachegrind compatible calltree in the performance_data directory.
96
+ - New rake tasks:
97
+ performance:benchmark runs benchmarks against all subjects in the performance directory and produces a consolidated output file in performance_data/benchmarks.out
98
+ performance:profile runs script/profile_subject against all subjects in the performance directory.
99
+ === 0.5.3 - 1 June, 2009
100
+ - Improved performance of time zone enumeration, TimeZonePeriod now caches occurrences
101
+ - Added a profiling directory which contains ruby programs which benchmark and/or profile performance
102
+ === 0.5.2
103
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/11
104
+ Export folding is not UTF-8 Safe
105
+ === 0.5.1
106
+ - Fixes README to acknowledge release on RubyForge
107
+ === 0.5.0 rubyforge release candidate Tue May 26 10:26:43 2009 -0400
108
+ - Added OccurrenceEnumerator#zulu_occurrence_range
109
+ === 0.0.11 Sat May 23 18:24:57 2009 -0400
110
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/5
111
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/9
112
+ === 0.0.10
113
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/8
114
+ === 0.0.9
115
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/4
116
+ Missing comparison methods in PropertyValue::Date
117
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/6
118
+ Type of dtstart and dtend (DATE or DATETIME) now preserved on enumeration
119
+ === 0.0.8
120
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941-ri_cal/tickets/1
121
+ EXDATE and RDATE now pick up the timezone from DateTime, Time, and TimeWithZone values
122
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/2
123
+ Missing arithmetic methods in PropertyValue::Date
124
+ - Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/3
125
+ Components with no recurrence rules or rdate properties failed on enumeration, they now
126
+ will enumerate a single occurrence
127
+ === 0.0.7
128
+ - Fixes a bug relating to properly recognizing ActiveRecord::TimeWithZone
129
+ - DATETIME propertyvalues will now return an instance of TimeWithZone instead of DateTime when
130
+ activesupport is present, and it is appropriate. See the README for details
131
+ === 0.0.6
132
+ - Added rake tasks to run specs with either the tzinfo gem or activesupport (<=2.2)
133
+ - Default rake task now runs both of these
134
+ === 0.0.5
135
+ - Fixes a bug in occurrence enumeration reported by paulsm on github
136
+ === 0.0.4
137
+ - Fixes a bug in imported timezones reported by paulsm on github
138
+ === 0.0.3
139
+ - Added tzid method to Ruby Time and DateTime instances, and to ActiveRecord::TimeWithZone if it is defined this method is used to determine the desired
140
+ timezone when an instance of one of these classes is given as the value of a datetime property. If the tzid is nil then the default tzid is used,
141
+ if it is set to :floating then the property will be a floating time.
142
+ - Removed the ability to pass an array with a tzid string and a date-time since the above made it unnecessary
143
+ - The ruby datetime property returned from the ruby_value method on the DateTime property will return an instance of ::DateTime with:
144
+ -- The proper utc offset
145
+ -- The tzid set to the right tzid
146
+ - Made exdate/rdate building possible
147
+ - Added a default_tzid attribute to the Calendar component, if this attribute is not set for a particular calendar it will delegate to the default set
148
+ for the DateTime property class.
149
+ - Added fix patches from
150
+ -- http://github.com/kjwierenga/ri_cal
151
+ -- http://github.com/wesmaldonado/ri_cal
152
+
153
+ === 0.0.2
154
+ - Fixes gemspec
155
+ == 0.0.1
156
+ - Initial public release
data/Manifest.txt ADDED
@@ -0,0 +1,161 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/ri_cal
6
+ component_attributes/alarm.yml
7
+ component_attributes/calendar.yml
8
+ component_attributes/component_property_defs.yml
9
+ component_attributes/event.yml
10
+ component_attributes/freebusy.yml
11
+ component_attributes/journal.yml
12
+ component_attributes/timezone.yml
13
+ component_attributes/timezone_period.yml
14
+ component_attributes/todo.yml
15
+ copyrights.txt
16
+ docs/draft-ietf-calsify-2446bis-08.txt
17
+ docs/draft-ietf-calsify-rfc2445bis-09.txt
18
+ docs/incrementers.txt
19
+ docs/rfc2445.pdf
20
+ lib/ri_cal.rb
21
+ lib/ri_cal/component.rb
22
+ lib/ri_cal/component/alarm.rb
23
+ lib/ri_cal/component/calendar.rb
24
+ lib/ri_cal/component/event.rb
25
+ lib/ri_cal/component/freebusy.rb
26
+ lib/ri_cal/component/journal.rb
27
+ lib/ri_cal/component/non_standard.rb
28
+ lib/ri_cal/component/t_z_info_timezone.rb
29
+ lib/ri_cal/component/timezone.rb
30
+ lib/ri_cal/component/timezone/daylight_period.rb
31
+ lib/ri_cal/component/timezone/standard_period.rb
32
+ lib/ri_cal/component/timezone/timezone_period.rb
33
+ lib/ri_cal/component/todo.rb
34
+ lib/ri_cal/core_extensions.rb
35
+ lib/ri_cal/core_extensions/array.rb
36
+ lib/ri_cal/core_extensions/array/conversions.rb
37
+ lib/ri_cal/core_extensions/date.rb
38
+ lib/ri_cal/core_extensions/date/conversions.rb
39
+ lib/ri_cal/core_extensions/date_time.rb
40
+ lib/ri_cal/core_extensions/date_time/conversions.rb
41
+ lib/ri_cal/core_extensions/object.rb
42
+ lib/ri_cal/core_extensions/object/conversions.rb
43
+ lib/ri_cal/core_extensions/string.rb
44
+ lib/ri_cal/core_extensions/string/conversions.rb
45
+ lib/ri_cal/core_extensions/time.rb
46
+ lib/ri_cal/core_extensions/time/calculations.rb
47
+ lib/ri_cal/core_extensions/time/conversions.rb
48
+ lib/ri_cal/core_extensions/time/tzid_access.rb
49
+ lib/ri_cal/core_extensions/time/week_day_predicates.rb
50
+ lib/ri_cal/fast_date_time.rb
51
+ lib/ri_cal/floating_timezone.rb
52
+ lib/ri_cal/invalid_property_value.rb
53
+ lib/ri_cal/invalid_timezone_identifier.rb
54
+ lib/ri_cal/occurrence_enumerator.rb
55
+ lib/ri_cal/occurrence_period.rb
56
+ lib/ri_cal/parser.rb
57
+ lib/ri_cal/properties.rb
58
+ lib/ri_cal/properties/alarm.rb
59
+ lib/ri_cal/properties/calendar.rb
60
+ lib/ri_cal/properties/event.rb
61
+ lib/ri_cal/properties/freebusy.rb
62
+ lib/ri_cal/properties/journal.rb
63
+ lib/ri_cal/properties/timezone.rb
64
+ lib/ri_cal/properties/timezone_period.rb
65
+ lib/ri_cal/properties/todo.rb
66
+ lib/ri_cal/property_value.rb
67
+ lib/ri_cal/property_value/array.rb
68
+ lib/ri_cal/property_value/cal_address.rb
69
+ lib/ri_cal/property_value/date.rb
70
+ lib/ri_cal/property_value/date_time.rb
71
+ lib/ri_cal/property_value/date_time/additive_methods.rb
72
+ lib/ri_cal/property_value/date_time/time_machine.rb
73
+ lib/ri_cal/property_value/date_time/timezone_support.rb
74
+ lib/ri_cal/property_value/duration.rb
75
+ lib/ri_cal/property_value/geo.rb
76
+ lib/ri_cal/property_value/integer.rb
77
+ lib/ri_cal/property_value/occurrence_list.rb
78
+ lib/ri_cal/property_value/period.rb
79
+ lib/ri_cal/property_value/recurrence_rule.rb
80
+ lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb
81
+ lib/ri_cal/property_value/recurrence_rule/enumerator.rb
82
+ lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb
83
+ lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb
84
+ lib/ri_cal/property_value/recurrence_rule/numbered_span.rb
85
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer.rb
86
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_day_incrementer.rb
87
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_hour_incrementer.rb
88
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_minute_incrementer.rb
89
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_month_incrementer.rb
90
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_monthday_incrementer.rb
91
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb
92
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_second_incrementer.rb
93
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_weekno_incrementer.rb
94
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_yearday_incrementer.rb
95
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/daily_incrementer.rb
96
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/frequency_incrementer.rb
97
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/hourly_incrementer.rb
98
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/list_incrementer.rb
99
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/minutely_incrementer.rb
100
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/monthly_incrementer.rb
101
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/null_sub_cycle_incrementer.rb
102
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/secondly_incrementer.rb
103
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/weekly_incrementer.rb
104
+ lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb
105
+ lib/ri_cal/property_value/recurrence_rule/recurring_day.rb
106
+ lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
107
+ lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb
108
+ lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb
109
+ lib/ri_cal/property_value/recurrence_rule/time_manipulation.rb
110
+ lib/ri_cal/property_value/recurrence_rule/validations.rb
111
+ lib/ri_cal/property_value/text.rb
112
+ lib/ri_cal/property_value/uri.rb
113
+ lib/ri_cal/property_value/utc_offset.rb
114
+ lib/ri_cal/required_timezones.rb
115
+ performance/empty_propval/subject.rb
116
+ performance/paris_eastern/subject.rb
117
+ performance/penultimate_weekday/subject.rb
118
+ performance/psm_big_enum/ical.ics
119
+ performance/psm_big_enum/subject.rb
120
+ performance/utah_cycling/subject.rb
121
+ ri_cal.gemspec
122
+ script/benchmark_subject
123
+ script/console
124
+ script/destroy
125
+ script/generate
126
+ script/profile_subject
127
+ script/txt2html
128
+ spec/ri_cal/bugreports_spec.rb
129
+ spec/ri_cal/component/alarm_spec.rb
130
+ spec/ri_cal/component/calendar_spec.rb
131
+ spec/ri_cal/component/event_spec.rb
132
+ spec/ri_cal/component/freebusy_spec.rb
133
+ spec/ri_cal/component/journal_spec.rb
134
+ spec/ri_cal/component/t_z_info_timezone_spec.rb
135
+ spec/ri_cal/component/timezone_spec.rb
136
+ spec/ri_cal/component/todo_spec.rb
137
+ spec/ri_cal/component_spec.rb
138
+ spec/ri_cal/core_extensions/string/conversions_spec.rb
139
+ spec/ri_cal/core_extensions/time/calculations_spec.rb
140
+ spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb
141
+ spec/ri_cal/fast_date_time_spec.rb
142
+ spec/ri_cal/occurrence_enumerator_spec.rb
143
+ spec/ri_cal/parser_spec.rb
144
+ spec/ri_cal/property_value/date_spec.rb
145
+ spec/ri_cal/property_value/date_time_spec.rb
146
+ spec/ri_cal/property_value/duration_spec.rb
147
+ spec/ri_cal/property_value/occurrence_list_spec.rb
148
+ spec/ri_cal/property_value/period_spec.rb
149
+ spec/ri_cal/property_value/recurrence_rule/recurring_year_day_spec.rb
150
+ spec/ri_cal/property_value/recurrence_rule_spec.rb
151
+ spec/ri_cal/property_value/text_spec.rb
152
+ spec/ri_cal/property_value/utc_offset_spec.rb
153
+ spec/ri_cal/property_value_spec.rb
154
+ spec/ri_cal/required_timezones_spec.rb
155
+ spec/ri_cal_spec.rb
156
+ spec/spec.opts
157
+ spec/spec_helper.rb
158
+ tasks/gem_loader/load_active_support.rb
159
+ tasks/gem_loader/load_tzinfo_gem.rb
160
+ tasks/ri_cal.rake
161
+ tasks/spec.rake
data/README.txt ADDED
@@ -0,0 +1,410 @@
1
+ == RI_CAL -- a new implementation of RFC2445 in Ruby
2
+ http://ri-cal.rubyforge.org/
3
+
4
+ by Rick DeNatale
5
+ == DESCRIPTION:
6
+
7
+ A new Ruby implementation of RFC2445 iCalendar.
8
+
9
+ The existing Ruby iCalendar libraries (e.g. icalendar, vpim) provide for parsing and generating icalendar files,
10
+ but do not support important things like enumerating occurrences of repeating events.
11
+
12
+ This is a clean-slate implementation of RFC2445.
13
+
14
+ A Google group for discussion of this library has been set up http://groups.google.com/group/rical_gem
15
+
16
+ == FEATURES/PROBLEMS:
17
+
18
+ * All examples of recurring events in RFC 2445 are handled. RSpec examples are provided for them.
19
+
20
+ == SYNOPSIS:
21
+
22
+ For the full RDOC see http://ri-cal.rubyforge.org/rdoc/
23
+
24
+ === Components and properties
25
+
26
+ An iCalendar calendar comprises subcomponents like Events, Timezones and Todos. Each component may
27
+ have properties, for example an event has a dtstart property which defines the time (and date) on
28
+ which the event starts.
29
+
30
+ RiCal components will provide reasonable ruby objects as the values of these properties, and allow
31
+ the properties to be set to ruby objects which are reasonable for the particular property. For
32
+ example time properties like dtstart can be set to a ruby Time, DateTime or Date object, and will
33
+ return a DateTime or Date object when queried.
34
+
35
+ The methods for accessing the properties of each type of component are defined in a module with the
36
+ same name as the component class in the RiCal::properties module. For example the property
37
+ accessing methods for RiCal::Component::Event are defined in RiCal::Properties::Event
38
+
39
+ === Creating Calendars and Calendar Components
40
+
41
+ RiCal provides a builder DSL for creating calendars and calendar components. An example
42
+
43
+ RiCal.Calendar do
44
+ event do
45
+ description "MA-6 First US Manned Spaceflight"
46
+ dtstart DateTime.parse("2/20/1962 14:47:39")
47
+ dtend DateTime.parse("2/20/1962 19:43:02")
48
+ location "Cape Canaveral"
49
+ add_attendee "john.glenn@nasa.gov"
50
+ alarm do
51
+ description "Segment 51"
52
+ end
53
+ end
54
+ end
55
+
56
+ This style is for compatibility with the iCalendar and vpim to ease migration. The downside is that
57
+ the block is evaluated in the context of a different object which can cause surprises if the block
58
+ contains direct instance variable references or implicit references to self. Note that, in this
59
+ style, one must use 'declarative' method calls like dtstart to set values rather than more natural
60
+ attribute writer methods, like dtstart=
61
+
62
+ Alternatively you can pass a block with a single argument, in this case the component being built
63
+ will be passed as that argument
64
+
65
+ RiCal.Calendar do |cal|
66
+ cal.event do |event|
67
+ event.description = "MA-6 First US Manned Spaceflight"
68
+ event.dtstart = DateTime.parse("2/20/1962 14:47:39")
69
+ event.dtend = DateTime.parse("2/20/1962 19:43:02")
70
+ event.location = "Cape Canaveral"
71
+ event.add_attendee "john.glenn@nasa.gov"
72
+ event.alarm do
73
+ description "Segment 51"
74
+ end
75
+ end
76
+ end
77
+
78
+ As the example shows, the two styles can be mixed, the inner block which builds the alarm uses the
79
+ first style.
80
+
81
+ The blocks are evaluated in the context of an object which builds the calendar or calendar
82
+ component. method names starting with add_ or remove_ are sent to the component, method names which
83
+ correspond to a property value setter of the object being built will cause that setter to be sent
84
+ to the component with the provided value.
85
+
86
+ A method corresponding to the name of one of the components sub component will create the sub
87
+ component and evaluate a block if given in the context of the new subcomponent.
88
+
89
+ ==== Multiply occurring properties
90
+
91
+ Certain RFC Components have properties which may be specified multiple times, for example, an Event
92
+ may have zero or more comment properties, A component will have a family of methods for
93
+ building/manipulating such a property, e.g.
94
+
95
+ Event#comment:: will return an array of comment strings.
96
+ Event#comment=:: takes a single comment string and gives the event a single comment property,
97
+ replacing any existing comment property collection.
98
+ Event#comments=:: takes multiple comment string arguments and gives the event a comment property for each,
99
+ replacing any existing comment property collection.
100
+ Event#add_comment:: takes a single comment string argument and adds a comment property.
101
+ Event#add_comments:: takes multiple comment string arguments and adds a comment property for each.
102
+ Event#remove_comment:: takes a single comment string argument and removes an existing comment property with that value.
103
+ Event#remove_comments:: takes multiple comment string argument and removes an existing comment property with that value.
104
+
105
+
106
+ ==== Times, Time zones, and Floating Times
107
+
108
+ RFC2445 describes three different kinds of DATE-TIME values with respect to time zones:
109
+
110
+ 1. date-times with a local time. These have no actual time zone, instead they are to be
111
+ interpreted in the local time zone of the viewer. These floating times are used for things
112
+ like the New Years celebration which is observed at local midnight whether you happen to be
113
+ in Paris, London, or New York.
114
+
115
+ 2. date-times with UTC time. An application would either display these with an indication of
116
+ the time zone, or convert them to the viewer's time zone, perhaps depending on user settings.
117
+
118
+ 3. date-times with a specified time zone.
119
+
120
+ RiCal can be given ruby Time, DateTime, or Date objects for the value of properties requiring an
121
+ iCalendar DATE-TIME value. It can also be given a string
122
+
123
+ Note that a date only DATE-TIME value has no time zone by definition, effectively such values float
124
+ and describe a date as viewed by the user in his/her local time zone.
125
+
126
+ When a Ruby Time or DateTime instance is used to set properties with with a DATE-TIME value, it
127
+ needs to determine which of the three types it represents. RiCal is designed to make use of the
128
+ TimeWithZone support which has been part of the ActiveSupport component of Ruby on Rails since
129
+ Rails 2.2. However it's been carefully designed not to require Rails or ActiveSupport, but to
130
+ dynamically detect the presence of the TimeWithZone support.
131
+
132
+ RiCal adds accessor methods for a tzid attribute to the Ruby Time, and DateTime classes as well as
133
+ a set_tzid method which sets the tzid attribute and returns the receiver for convenience in
134
+ building calendars. If ActiveSupport::TimeWithZone is defined, a tzid instance method is defined
135
+ which returns the identifier of the time zone.
136
+
137
+ When the value of a DATE-TIME property is set to a value, the following processing occurs:
138
+
139
+ * If the value is a string, then it must be a valid rfc 2445 date or datetime string optionally
140
+ preceded by a parameter specification e.g
141
+
142
+ "20010911" will be interpreted as a date
143
+
144
+ "20090530T123000Z" will be interpreted as the time May 30, 2009 at 12:30:00 UTC
145
+
146
+ "20090530T123000" will be interpreted as the time May 30, 2009 with a floating time zone
147
+
148
+ "TZID=America/New_York:20090530T123000" will be interpreted as the time May 30, 2009 in the time zone identified by "America/New_York"
149
+
150
+ * If the value is a Date it will be interpreted as that date
151
+ * If the value is a Time, DateTime, or TimeWithZone then the tzid attribute will determine the
152
+ time zone. If tzid returns nil then the default tzid will be used.
153
+
154
+ ==== Default TZID
155
+
156
+ The PropertyValue::DateTime class has a default_tzid attribute which is initialized to "UTC".
157
+
158
+ The Component::Calendar class also has a default_tzid attribute, which may be set, but if it is not
159
+ set the default_tzid of the PropertyValue::DateTime class will be used.
160
+
161
+ To set the interpreting of Times and DateTimes which have no tzid as floating times, set the
162
+ default_tzid for Component::Calendar and/or PropertyValue::DateTime to :floating.
163
+
164
+ Also note that time zone identifiers are not standardized by RFC 2445. For an RiCal originated
165
+ calendar time zone identifiers recognized by the TZInfo gem, or the TZInfo implementation provided
166
+ by ActiveSupport as the case may be may be used. The valid time zone identifiers for a non-RiCal
167
+ generated calendar imported into RiCalendar are determined by the VTIMEZONE compoents within the
168
+ imported calendar.
169
+
170
+ If you use a timezone identifer within a calendar which is not defined within the calendar it will
171
+ detected at the time you try to convert a timezone. In this case an InvalidTimezoneIdentifier error
172
+ will be raised by the conversion method.
173
+
174
+ To explicitly set a floating time you can use the method #with_floating_timezone on Time or
175
+ DateTime instances as in
176
+
177
+ event.dtstart = Time.parse("1/1/2010 00:00:00").with_floating_timezone
178
+
179
+ or the equivalent
180
+
181
+ event.dtstart = Time.parse("1/1/2010 00:00:00").set_tzid(:floating)
182
+
183
+ === RiCal produced Calendars and Tzinfo
184
+
185
+ Calendars created by the RiCal Builder DSL use TZInfo as a source of time zone definition
186
+ information. RFC 2445 does not specify standard names for time zones, so each time zone identifier
187
+ (tzid) within an icalendar data stream must correspond to a VTIMEZONE component in that data
188
+ stream.
189
+
190
+ When an RiCal calendar is exported to an icalendar data stream, the needed VTIMEZONE components
191
+ will be generated. In addition a parameter is added to the PRODID property of the calendar which
192
+ identifies that the source of tzids is tzinfo. For purposes of this documentation such a calendar
193
+ is called a tzinfo calendar.
194
+
195
+ When RiCal imports an icalendar data stream produced by another library or application, such as
196
+ Apple's ical.app, or Google mail, it will be recognized as not being a non-tzinfo calendar, and any
197
+ tzids will be resolved using the included VTIMEZONEs. Note that these calendars may well use tzids
198
+ which are not recognizable by the tzinfo gem or by the similar code provided by ActiveSupport,
199
+ so care is needed in using them.
200
+
201
+ === Ruby values of DATETIME properties
202
+
203
+ The result of accessing the value of a DATETIME property (e.g. event.dtstart) depends on several
204
+ factors:
205
+
206
+ * If the property has a DATE value, then the result will be a Ruby Date object.
207
+
208
+ * Otherwise, if the property has a DATETIME value with a floating timezone, then the result will
209
+ be a Ruby DateTime object, the tzid attribute will be set to :floating, and will respond
210
+ truthily to has_floating_timezone?
211
+
212
+ * Otherwise if the value is attached to a property contained in a non-tzinfo calendar, or if the
213
+ ActiveSupport gem is not loaded, then the result will be a Ruby DateTime object, with the proper
214
+ offset from UTC, and with the tzid property set.
215
+
216
+ * Finally, if the value is attached to a property contained in a tzinfo calendar and the
217
+ ActiveSupport gem is loaded, then the result will be an ActiveSupport::TimeWithZone with the
218
+ proper tzid.
219
+
220
+ ==== RDATE, and EXDATE properties (Occurrence Lists)
221
+
222
+ A calendar component which supports recurrence properties (e.g. Event) may have zero or more RDATE
223
+ and or EXDATE properties. Each RDATE/EXDATE property in turn specifies one or more occurrences to
224
+ be either added to or removed from the component's recurrence list. Each element of the list may be
225
+ either a DATE, a DATETIME, or a PERIOD, or the RFC 2445 string representation of one of these:
226
+
227
+ event.rdate = "20090305"
228
+ event.rdate = "20090305T120000"
229
+ event.rdate = "20090305T120000/P1H30M"
230
+
231
+ It can also have multiple occurrences, specified as multiple parameters:
232
+
233
+ event.rdate = "20090305T120000", "20090405T120000"
234
+ event.rdate = DateTime.parse("12 December, 2005 3:00 pm"), DateTime.civil(2001, 3, 4, 15, 30, 0)
235
+
236
+
237
+ Multiple string values can be combined separated by commas:
238
+
239
+ event.rdate = "20090305T120000,20090405T120000"
240
+
241
+
242
+ An occurrence list has one set of parameters, so only one timezone can be used, the timezone may
243
+ be set explicitly via the first argument. If the first argument is a string, it is first split on
244
+ commas. Then if the first segment (up to the first comma if any) is not a valid RFC 2445
245
+ representation of a DATE, DATETIME, or PERIOD, then it will be used as the timezone for the
246
+ occurrence list. Otherwise the arguments must have the same time zone or an InvalidPropertyValue
247
+ error will be raised.
248
+ === Parsing
249
+
250
+ RiCal can parse icalendar data from either a string or a Ruby io object.
251
+
252
+ The data may consist of one or more icalendar calendars, or one or more icalendar components (e.g.
253
+ one or more VEVENT, or VTODO objects.)
254
+
255
+ In either case the result will be an array of components.
256
+ ==== From a string
257
+ RiCal.parse_string <<ENDCAL
258
+ BEGIN:VCALENDAR
259
+ X-WR-TIMEZONE:America/New_York
260
+ PRODID:-//Apple Inc.//iCal 3.0//EN
261
+ CALSCALE:GREGORIAN
262
+ X-WR-CALNAME:test
263
+ VERSION:2.0
264
+ X-WR-RELCALID:1884C7F8-BC8E-457F-94AC-297871967D5E
265
+ X-APPLE-CALENDAR-COLOR:#2CA10B
266
+ BEGIN:VTIMEZONE
267
+ TZID:US/Eastern
268
+ BEGIN:DAYLIGHT
269
+ TZOFFSETFROM:-0500
270
+ TZOFFSETTO:-0400
271
+ DTSTART:20070311T020000
272
+ RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
273
+ TZNAME:EDT
274
+ END:DAYLIGHT
275
+ BEGIN:STANDARD
276
+ TZOFFSETFROM:-0400
277
+ TZOFFSETTO:-0500
278
+ DTSTART:20071104T020000
279
+ RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
280
+ TZNAME:EST
281
+ END:STANDARD
282
+ END:VTIMEZONE
283
+ BEGIN:VEVENT
284
+ SEQUENCE:5
285
+ TRANSP:OPAQUE
286
+ UID:00481E53-9258-4EA7-9F8D-947D3041A3F2
287
+ DTSTART;TZID=US/Eastern:20090224T090000
288
+ DTSTAMP:20090225T000908Z
289
+ SUMMARY:Test Event
290
+ CREATED:20090225T000839Z
291
+ DTEND;TZID=US/Eastern:20090224T100000
292
+ RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20090228T045959Z
293
+ END:VEVENT
294
+ END:VCALENDAR
295
+ ENDCAL
296
+
297
+ <b>Beware of the initial whitespace in the above example which is for rdoc formatting.</b> The parser does not strip initial whitespace from lines in the file and will fail.
298
+
299
+ As already stated the string argument may be a full icalendar format calendar, or just one or more subcomponents, e.g.
300
+
301
+ RiCal.parse_string("BEGIN:VEVENT\nDTSTART;TZID=US/Eastern:20090224T090000\nSUMMARY:Test Event\nDTEND;TZID=US/Eastern:20090224T100000\nRRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20090228T045959Z\nEND:VEVENT")
302
+
303
+ ==== From an Io
304
+ File.open("path/to/file", "r") do |file|
305
+ components = RiCal.parse(file)
306
+ end
307
+
308
+ === Occurrence Enumeration
309
+
310
+ Event, Journal, and Todo components can have recurrences which are defined following the RFC 2445 specification.
311
+ A component with recurrences can enumerate those occurrences.
312
+
313
+ These components have common methods for enumeration which are defined in the RiCal::OccurrenceEnumerator module.
314
+
315
+ ==== Obtaining an array of occurrences
316
+
317
+ To get an array of occurrences, Use the RiCal::OccurrenceEnumerator#occurrences method:
318
+
319
+ event.occurrences
320
+
321
+ This method may fail with an argument error, if the component has an unbounded recurrence definition. This happens
322
+ when one or more of its RRULES don't have a COUNT, or UNTIL part. This may be tested by using the RiCal::OccurrenceEnumerator#bounded? method.
323
+
324
+ In the case of unbounded components, you must either use the :count, or :before options of the RiCal::OccurrenceEnumerator#occurrences method:
325
+
326
+ event.occurrences(:count => 10)
327
+
328
+ or
329
+
330
+ event.occurrences(:before => Date.today >> 1)
331
+
332
+ Another option on the occurrences method is the :overlapping option, which takes an array of two Dates, Times or DateTimes which are expected to be in chronological order. Only events which occur either partially or fully within the range given by the :overlapping option will be enumerated.
333
+
334
+ Alternately, you can use the RiCal::OccurrenceEnumerator#each method,
335
+ or another Enumerable method (RiCal::OccurrenceEnumerator includes Enumerable), and terminate when you wish by breaking out of the block.
336
+
337
+ event.each do |event|
338
+ break if some_termination_condition
339
+ #....
340
+ end
341
+
342
+ === Unknown Components
343
+
344
+ Starting with version 0.8.0 RiCal will parse calendars and components which contain nonstandard components.
345
+
346
+ For example, there was a short-lived proposal to extend RFC2445 with a new VVENUE component which would hold structured information about the location of an event. This proposal was never accepted and was withdrawn, but there is icalendar data in the wild which contains VVENUE components.
347
+
348
+ Prior to version 0.8.0, RiCal would raise an exception if unknown component types were encountered. Starting with version 0.8.0 RiCal will 'parse' such components and create instances of NonStandard component to represent them. Since the actual format of unknown components is not known by RiCal, the NonStandard component will simply save the data lines between the BEGIN:xxx and END:xxx lines, (where xxx is the non-standard component name, e.g. VVENUE). If the calendar is re-exported the original lines will be replayed.
349
+
350
+ === Change to treatment of X-properties
351
+
352
+ RFC2445 allows 'non-standard' or experimental properties which property-names beginning with X. RiCal always supported parsing these.
353
+
354
+ The standard properties are specified as to how many times they can occur within a particular component. For singly occurring properties RiCal returns a single property object, while for properties which can occur multiple times RiCal returns an array of property objects.
355
+
356
+ While implementing NonStandard properties, I realized that X-properties were being assumed to be singly occurring. But this isn't necessarily true. So starting with 0.8.0 the X-properties are represented by an array of property objects.
357
+
358
+ THIS MAY BREAK SOME APPLICATIONS, but the adaptation should be easy.
359
+
360
+ == REQUIREMENTS:
361
+
362
+ * RiCal requires that an implementation of TZInfo::Timezone. This requirement may be satisfied by either the TzInfo gem,
363
+ or by a recent(>= 2.2) version of the ActiveSupport gem which is part of Ruby on Rails.
364
+
365
+ == INSTALL:
366
+
367
+ === From RubyForge
368
+
369
+ sudo gem install ri_cal
370
+
371
+ === From github
372
+
373
+ ==== As a Gem
374
+
375
+ sudo gem install rubyredrick-ri_cal --source http://gems.github.com/
376
+
377
+ ==== From source
378
+
379
+ 1. cd to a directory in which you want to install ri_cal as a subdirectory
380
+ 2. git clone http://github.com/rubyredrick/ri_cal your_install_subdirectory
381
+ 3. cd your_install_directory
382
+ 4. rake spec
383
+ 5. rake install_gem
384
+
385
+
386
+
387
+ == LICENSE:
388
+
389
+ (The MIT License)
390
+
391
+ Copyright (c) 2009 Richard J. DeNatale
392
+
393
+ Permission is hereby granted, free of charge, to any person obtaining
394
+ a copy of this software and associated documentation files (the
395
+ 'Software'), to deal in the Software without restriction, including
396
+ without limitation the rights to use, copy, modify, merge, publish,
397
+ distribute, sublicense, and/or sell copies of the Software, and to
398
+ permit persons to whom the Software is furnished to do so, subject to
399
+ the following conditions:
400
+
401
+ The above copyright notice and this permission notice shall be
402
+ included in all copies or substantial portions of the Software.
403
+
404
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
405
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
406
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
407
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
408
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
409
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
410
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.