ri_cal 0.8.2 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. data/History.txt +10 -0
  2. data/Manifest.txt +23 -3
  3. data/lib/ri_cal.rb +28 -16
  4. data/lib/ri_cal/component.rb +11 -7
  5. data/lib/ri_cal/component/alarm.rb +0 -2
  6. data/lib/ri_cal/component/calendar.rb +0 -2
  7. data/lib/ri_cal/component/event.rb +0 -2
  8. data/lib/ri_cal/component/freebusy.rb +0 -2
  9. data/lib/ri_cal/component/journal.rb +0 -3
  10. data/lib/ri_cal/component/non_standard.rb +0 -2
  11. data/lib/ri_cal/component/timezone.rb +5 -5
  12. data/lib/ri_cal/component/timezone/timezone_period.rb +0 -2
  13. data/lib/ri_cal/component/todo.rb +0 -2
  14. data/lib/ri_cal/core_extensions.rb +8 -3
  15. data/lib/ri_cal/core_extensions/array.rb +1 -1
  16. data/lib/ri_cal/core_extensions/date.rb +3 -3
  17. data/lib/ri_cal/core_extensions/date_time.rb +4 -4
  18. data/lib/ri_cal/core_extensions/object.rb +1 -1
  19. data/lib/ri_cal/core_extensions/string.rb +1 -1
  20. data/lib/ri_cal/core_extensions/time.rb +5 -4
  21. data/lib/ri_cal/fast_date_time.rb +1 -1
  22. data/lib/ri_cal/{invalid_timezone_identifer.rb → invalid_timezone_identifier.rb} +0 -0
  23. data/lib/ri_cal/properties.rb +12 -0
  24. data/lib/ri_cal/property_value.rb +14 -5
  25. data/lib/ri_cal/property_value/duration.rb +1 -1
  26. data/lib/ri_cal/property_value/recurrence_rule.rb +13 -4
  27. data/lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb +16 -13
  28. data/lib/ri_cal/property_value/recurrence_rule/enumerator.rb +1 -1
  29. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer.rb +134 -0
  30. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_day_incrementer.rb +82 -0
  31. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_hour_incrementer.rb +31 -0
  32. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_minute_incrementer.rb +32 -0
  33. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_month_incrementer.rb +52 -0
  34. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_monthday_incrementer.rb +31 -0
  35. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb +34 -0
  36. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_second_incrementer.rb +32 -0
  37. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_weekno_incrementer.rb +65 -0
  38. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_yearday_incrementer.rb +31 -0
  39. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/daily_incrementer.rb +28 -0
  40. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/frequency_incrementer.rb +71 -0
  41. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/hourly_incrementer.rb +23 -0
  42. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/list_incrementer.rb +96 -0
  43. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/minutely_incrementer.rb +23 -0
  44. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/monthly_incrementer.rb +33 -0
  45. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/null_sub_cycle_incrementer.rb +39 -0
  46. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/secondly_incrementer.rb +28 -0
  47. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/weekly_incrementer.rb +37 -0
  48. data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb +57 -0
  49. data/lib/ri_cal/property_value/recurrence_rule/time_manipulation.rb +42 -0
  50. data/ri_cal.gemspec +3 -3
  51. metadata +25 -5
  52. data/lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb +0 -793
  53. data/sample_ical_files/from_ical_dot_app/test1.ics +0 -38
data/History.txt CHANGED
@@ -1,3 +1,13 @@
1
+ === 0.8.3 - 18 September 2009
2
+ Refactored load structure, should now be conforming to
3
+ http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices
4
+ I did finesse the load path issue a bit as a workaround to RSpec not putting lib on $LOADPATH
5
+ the lib directory will get added to load path IF IT ISN"T ALREADY THERE
6
+
7
+ Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/25
8
+ please clean your code up to be quiet
9
+
10
+ Thanks to Ryan for such a courteous problem report.
1
11
  === 0.8.2 - 4 September 2009
2
12
  Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/23
3
13
  initialization_methodsrb-syntax
data/Manifest.txt CHANGED
@@ -50,10 +50,11 @@ lib/ri_cal/core_extensions/time/week_day_predicates.rb
50
50
  lib/ri_cal/fast_date_time.rb
51
51
  lib/ri_cal/floating_timezone.rb
52
52
  lib/ri_cal/invalid_property_value.rb
53
- lib/ri_cal/invalid_timezone_identifer.rb
53
+ lib/ri_cal/invalid_timezone_identifier.rb
54
54
  lib/ri_cal/occurrence_enumerator.rb
55
55
  lib/ri_cal/occurrence_period.rb
56
56
  lib/ri_cal/parser.rb
57
+ lib/ri_cal/properties.rb
57
58
  lib/ri_cal/properties/alarm.rb
58
59
  lib/ri_cal/properties/calendar.rb
59
60
  lib/ri_cal/properties/event.rb
@@ -81,11 +82,31 @@ lib/ri_cal/property_value/recurrence_rule/enumerator.rb
81
82
  lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb
82
83
  lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb
83
84
  lib/ri_cal/property_value/recurrence_rule/numbered_span.rb
84
- lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.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
85
105
  lib/ri_cal/property_value/recurrence_rule/recurring_day.rb
86
106
  lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
87
107
  lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb
88
108
  lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb
109
+ lib/ri_cal/property_value/recurrence_rule/time_manipulation.rb
89
110
  lib/ri_cal/property_value/recurrence_rule/validations.rb
90
111
  lib/ri_cal/property_value/text.rb
91
112
  lib/ri_cal/property_value/uri.rb
@@ -98,7 +119,6 @@ performance/psm_big_enum/ical.ics
98
119
  performance/psm_big_enum/subject.rb
99
120
  performance/utah_cycling/subject.rb
100
121
  ri_cal.gemspec
101
- sample_ical_files/from_ical_dot_app/test1.ics
102
122
  script/benchmark_subject
103
123
  script/console
104
124
  script/destroy
data/lib/ri_cal.rb CHANGED
@@ -9,12 +9,35 @@ module RiCal
9
9
 
10
10
  my_dir = File.dirname(__FILE__)
11
11
 
12
- autoload :Component, "#{my_dir}/ri_cal/component.rb"
13
- autoload :TimezonePeriod, "#{my_dir}/ri_cal/properties/timezone_period.rb"
14
- autoload :OccurrenceEnumerator, "#{my_dir}/ri_cal/occurrence_enumerator.rb"
12
+ $LOAD_PATH << my_dir unless $LOAD_PATH.include?(my_dir)
13
+
14
+ if Object.const_defined?(:ActiveSupport)
15
+ as = Object.const_get(:ActiveSupport)
16
+ if as.const_defined?(:TimeWithZone)
17
+ time_with_zone = as.const_get(:TimeWithZone)
18
+ end
19
+ end
15
20
 
21
+ # TimeWithZone will be set to ActiveSupport::TimeWithZone if the activesupport gem is loaded
22
+ # otherwise it will be nil
23
+ TimeWithZone = time_with_zone
24
+
25
+ autoload :Component, "ri_cal/component.rb"
26
+ autoload :CoreExtensions, "ri_cal/core_extensions.rb"
27
+ autoload :FastDateTime, "ri_cal/fast_date_time.rb"
28
+ autoload :FloatingTimezone, "ri_cal/floating_timezone.rb"
29
+ autoload :InvalidPropertyValue, "ri_cal/invalid_property_value.rb"
30
+ autoload :InvalidTimezoneIdentifier, "ri_cal/invalid_timezone_identifier.rb"
31
+ autoload :OccurrenceEnumerator, "ri_cal/occurrence_enumerator.rb"
32
+ autoload :OccurrencePeriod, "ri_cal/occurrence_period.rb"
33
+ autoload :TimezonePeriod, "ri_cal/properties/timezone_period.rb"
34
+ autoload :Parser, "ri_cal/parser.rb"
35
+ autoload :Properties, "ri_cal/properties.rb"
36
+ autoload :PropertyValue, "ri_cal/property_value.rb"
37
+ autoload :RequiredTimezones, "ri_cal/required_timezones.rb"
38
+ require "ri_cal/core_extensions.rb"
16
39
  # :stopdoc:
17
- VERSION = '0.8.2'
40
+ VERSION = '0.8.4'
18
41
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
19
42
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
20
43
 
@@ -123,17 +146,6 @@ module RiCal
123
146
  Component::TimezonePeriod.new(&init_block)
124
147
  end
125
148
 
126
- if Object.const_defined?(:ActiveSupport)
127
- as = Object.const_get(:ActiveSupport)
128
- if as.const_defined?(:TimeWithZone)
129
- time_with_zone = as.const_get(:TimeWithZone)
130
- end
131
- end
132
-
133
- # TimeWithZone will be set to ActiveSupport::TimeWithZone if the activesupport gem is loaded
134
- # otherwise it will be nil
135
- TimeWithZone = time_with_zone
136
-
137
149
  # return a new Todo calendar component. If a block is provided it will will be executed in
138
150
  # the context of a builder object which can be used to initialize the properties and alarms of the
139
151
  # new Todo.
@@ -171,5 +183,5 @@ end # module RiCal
171
183
  end
172
184
 
173
185
 
174
- RiCal.require_all_libs_relative_to(__FILE__)
186
+ #RiCal.require_all_libs_relative_to(__FILE__)
175
187
  # EOF
@@ -2,6 +2,17 @@ module RiCal
2
2
  #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
3
3
  #
4
4
  class Component #:nodoc:
5
+
6
+ autoload :Alarm, "ri_cal/component/alarm.rb"
7
+ autoload :Calendar, "ri_cal/component/calendar.rb"
8
+ autoload :Event, "ri_cal/component/event.rb"
9
+ autoload :Freebusy, "ri_cal/component/freebusy.rb"
10
+ autoload :Journal, "ri_cal/component/journal.rb"
11
+ autoload :NonStandard, "ri_cal/component/non_standard.rb"
12
+ autoload :TZInfoTimezone, "ri_cal/component/t_z_info_timezone.rb"
13
+ autoload :Timezone, "ri_cal/component/timezone.rb"
14
+ autoload :Todo, "ri_cal/component/todo.rb"
15
+
5
16
  class ComponentBuilder #:nodoc:
6
17
  def initialize(component)
7
18
  @component = component
@@ -30,8 +41,6 @@ module RiCal
30
41
  end
31
42
  end
32
43
 
33
- autoload :Timezone, "#{File.dirname(__FILE__)}/component/timezone.rb"
34
-
35
44
  attr_accessor :imported #:nodoc:
36
45
 
37
46
  def initialize(parent=nil, entity_name = nil, &init_block) #:nodoc:
@@ -241,9 +250,4 @@ module RiCal
241
250
  wrapper_calendar.export(stream)
242
251
  end
243
252
  end
244
- end
245
-
246
- Dir[File.dirname(__FILE__) + "/component/*.rb"].sort.each do |path|
247
- filename = File.basename(path)
248
- require path
249
253
  end
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), %w[.. properties alarm.rb])
2
-
3
1
  module RiCal
4
2
 
5
3
  class Component
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), %w[.. properties calendar.rb])
2
-
3
1
  module RiCal
4
2
  class Component
5
3
  #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), %w[.. properties event.rb])
2
-
3
1
  module RiCal
4
2
  class Component
5
3
  #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), %w[.. properties freebusy.rb])
2
-
3
1
  module RiCal
4
2
  class Component
5
3
  #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
@@ -1,6 +1,3 @@
1
-
2
- require File.join(File.dirname(__FILE__), %w[.. properties journal.rb])
3
-
4
1
  module RiCal
5
2
  class Component
6
3
  #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), %w[.. properties alarm.rb])
2
-
3
1
  module RiCal
4
2
 
5
3
  class Component
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), %w[.. properties timezone.rb])
2
-
3
1
  module RiCal
4
2
  class Component
5
3
  #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
@@ -10,6 +8,11 @@ module RiCal
10
8
  #
11
9
  # to see the property accessing methods for this class see the RiCal::Properties::Timezone module
12
10
  class Timezone < Component
11
+
12
+ autoload :TimezonePeriod, "ri_cal/component/timezone/timezone_period.rb"
13
+ autoload :StandardPeriod, "ri_cal/component/timezone/standard_period.rb"
14
+ autoload :DaylightPeriod, "ri_cal/component/timezone/daylight_period.rb"
15
+
13
16
  include RiCal::Properties::Timezone
14
17
 
15
18
  # The identifier of the timezone, e.g. "Europe/Paris".
@@ -192,6 +195,3 @@ module RiCal
192
195
  end
193
196
 
194
197
 
195
- %w[timezone_period.rb daylight_period.rb standard_period.rb].each do |filename|
196
- require "#{File.dirname(__FILE__)}/timezone/#{filename}"
197
- end
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), %w[.. .. properties timezone_period.rb])
2
-
3
1
  module RiCal
4
2
  class Component
5
3
  class Timezone
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), %w[.. properties todo.rb])
2
-
3
1
  module RiCal
4
2
  class Component
5
3
  #- ©2009 Rick DeNatale
@@ -1,6 +1,11 @@
1
1
  #- ©2009 Rick DeNatale
2
2
  #- All rights reserved. Refer to the file README.txt for the license
3
3
  #
4
- Dir[File.dirname(__FILE__) + "/core_extensions/*.rb"].sort.each do |path|
5
- require path
6
- end
4
+
5
+ require "ri_cal/core_extensions/array.rb"
6
+ require "ri_cal/core_extensions/date.rb"
7
+ require "ri_cal/core_extensions/date_time.rb"
8
+ require "ri_cal/core_extensions/object.rb"
9
+ require "ri_cal/core_extensions/string.rb"
10
+ require "ri_cal/core_extensions/time.rb"
11
+
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/array/conversions.rb"
1
+ require "ri_cal/core_extensions/array/conversions.rb"
2
2
  class Array #:nodoc:
3
3
  #- ©2009 Rick DeNatale
4
4
  #- All rights reserved. Refer to the file README.txt for the license
@@ -1,6 +1,6 @@
1
- require "#{File.dirname(__FILE__)}/date/conversions.rb"
2
- require "#{File.dirname(__FILE__)}/time/week_day_predicates.rb"
3
- require "#{File.dirname(__FILE__)}/time/calculations.rb"
1
+ require "ri_cal/core_extensions/date/conversions.rb"
2
+ require "ri_cal/core_extensions/time/week_day_predicates.rb"
3
+ require "ri_cal/core_extensions/time/calculations.rb"
4
4
  require 'date'
5
5
 
6
6
  class Date #:nodoc:
@@ -1,7 +1,7 @@
1
- require "#{File.dirname(__FILE__)}/date_time/conversions.rb"
2
- require "#{File.dirname(__FILE__)}/time/tzid_access.rb"
3
- require "#{File.dirname(__FILE__)}/time/week_day_predicates.rb"
4
- require "#{File.dirname(__FILE__)}/time/calculations.rb"
1
+ require "ri_cal/core_extensions/date_time/conversions.rb"
2
+ require "ri_cal/core_extensions/time/tzid_access.rb"
3
+ require "ri_cal/core_extensions/time/week_day_predicates.rb"
4
+ require "ri_cal/core_extensions/time/calculations.rb"
5
5
  require 'date'
6
6
 
7
7
  class DateTime #:nodoc:
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/object/conversions.rb"
1
+ require "ri_cal/core_extensions/object/conversions.rb"
2
2
 
3
3
  class Object #:nodoc:
4
4
  #- ©2009 Rick DeNatale
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/string/conversions.rb"
1
+ require "ri_cal/core_extensions/string/conversions.rb"
2
2
 
3
3
  class String #:nodoc:
4
4
  #- ©2009 Rick DeNatale
@@ -1,10 +1,11 @@
1
- require "#{File.dirname(__FILE__)}/time/conversions.rb"
2
- require "#{File.dirname(__FILE__)}/time/tzid_access.rb"
3
- require "#{File.dirname(__FILE__)}/time/week_day_predicates.rb"
4
- require "#{File.dirname(__FILE__)}/time/calculations.rb"
5
1
  #- ©2009 Rick DeNatale
6
2
  #- All rights reserved. Refer to the file README.txt for the license
7
3
  #
4
+ require "ri_cal/core_extensions/time/conversions.rb"
5
+ require "ri_cal/core_extensions/time/tzid_access.rb"
6
+ require "ri_cal/core_extensions/time/week_day_predicates.rb"
7
+ require "ri_cal/core_extensions/time/calculations.rb"
8
+
8
9
  class Time #:nodoc:
9
10
  include RiCal::CoreExtensions::Time::WeekDayPredicates
10
11
  include RiCal::CoreExtensions::Time::Calculations
@@ -130,7 +130,7 @@ module RiCal
130
130
  [day_delta, new_secs_since_bod]
131
131
  elsif new_secs_since_bod > 0
132
132
  [day_delta + (new_secs_since_bod / SECONDS_IN_A_DAY), new_secs_since_bod % SECONDS_IN_A_DAY]
133
- else new_secs_since_bod
133
+ else
134
134
  [day_delta - (1 + new_secs_since_bod.abs / SECONDS_IN_A_DAY),
135
135
  SECONDS_IN_A_DAY - (new_secs_since_bod.abs % SECONDS_IN_A_DAY)]
136
136
  end
@@ -0,0 +1,12 @@
1
+ module RiCal
2
+ module Properties #:nodoc:
3
+ autoload :Alarm, "ri_cal/properties/alarm.rb"
4
+ autoload :Calendar, "ri_cal/properties/calendar.rb"
5
+ autoload :Event, "ri_cal/properties/event.rb"
6
+ autoload :Freebusy, "ri_cal/properties/freebusy.rb"
7
+ autoload :Journal, "ri_cal/properties/journal.rb"
8
+ autoload :Timezone, "ri_cal/properties/timezone.rb"
9
+ autoload :TimezonePeriod, "ri_cal/properties/timezone_period.rb"
10
+ autoload :Todo, "ri_cal/properties/todo.rb"
11
+ end
12
+ end
@@ -3,6 +3,20 @@ module RiCal
3
3
  #
4
4
  # PropertyValue provides common implementation of various RFC 2445 property value types
5
5
  class PropertyValue
6
+
7
+ autoload :Array, "ri_cal/property_value/array.rb"
8
+ autoload :CalAddress, "ri_cal/property_value/cal_address.rb"
9
+ autoload :Date, "ri_cal/property_value/date.rb"
10
+ autoload :DateTime, "ri_cal/property_value/date_time.rb"
11
+ autoload :Duration, "ri_cal/property_value/duration.rb"
12
+ autoload :Geo, "ri_cal/property_value/geo.rb"
13
+ autoload :Integer, "ri_cal/property_value/integer.rb"
14
+ autoload :OccurrenceList, "ri_cal/property_value/occurrence_list.rb"
15
+ autoload :Period, "ri_cal/property_value/period.rb"
16
+ autoload :RecurrenceRule, "ri_cal/property_value/recurrence_rule.rb"
17
+ autoload :Text, "ri_cal/property_value/text.rb"
18
+ autoload :Uri, "ri_cal/property_value/uri.rb"
19
+ autoload :UtcOffset, "ri_cal/property_value/utc_offset.rb"
6
20
 
7
21
  attr_writer :params, :value #:nodoc:
8
22
  attr_reader :timezone_finder #:nodoc:
@@ -142,8 +156,3 @@ module RiCal
142
156
  end
143
157
  end
144
158
  end
145
-
146
- Dir[File.dirname(__FILE__) + "/property_value/*.rb"].sort.each do |path|
147
- filename = File.basename(path)
148
- require path
149
- end
@@ -34,7 +34,7 @@ module RiCal
34
34
  end
35
35
 
36
36
  def self.convert(parent, ruby_object) # :nodoc:
37
- ruby_object.to_ri_cal_duration_value.for_parent(parent)
37
+ ruby_object.to_ri_cal_duration_value
38
38
  end
39
39
 
40
40
  def value=(string) # :nodoc:
@@ -1,7 +1,3 @@
1
- Dir[File.dirname(__FILE__) + "/recurrence_rule/*.rb"].sort.each do |path|
2
- require path
3
- end
4
-
5
1
  module RiCal
6
2
  class PropertyValue
7
3
  #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
@@ -11,6 +7,19 @@ module RiCal
11
7
  # rfc 2445 section 4.3.10 pp 40-45
12
8
  class RecurrenceRule < PropertyValue
13
9
 
10
+ autoload :EnumerationSupportMethods, "ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb"
11
+ autoload :OccurrenceIncrementer, "ri_cal/property_value/recurrence_rule/occurrence_incrementer.rb"
12
+ autoload :Enumerator, "ri_cal/property_value/recurrence_rule/enumerator.rb"
13
+ autoload :InitializationMethods, "ri_cal/property_value/recurrence_rule/initialization_methods.rb"
14
+ autoload :NegativeSetposEnumerator, "ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb"
15
+ autoload :NumberedSpan, "ri_cal/property_value/recurrence_rule/numbered_span.rb"
16
+ autoload :RecurringDay, "ri_cal/property_value/recurrence_rule/recurring_day.rb"
17
+ autoload :RecurringMonthDay, "ri_cal/property_value/recurrence_rule/recurring_month_day.rb"
18
+ autoload :RecurringNumberedWeek, "ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb"
19
+ autoload :RecurringYearDay, "ri_cal/property_value/recurrence_rule/recurring_year_day.rb"
20
+ autoload :TimeManipulation, "ri_cal/property_value/recurrence_rule/time_manipulation.rb"
21
+ autoload :Validations, "ri_cal/property_value/recurrence_rule/validations.rb"
22
+
14
23
  def initialize(parent, value_hash) # :nodoc:
15
24
  @by_list_hash = {}
16
25
  super
@@ -16,21 +16,21 @@ module RiCal
16
16
  start_time.change(:seconds => 0)
17
17
  when "HOURLY"
18
18
  start_time.change(
19
- :minutes => 0,
19
+ :minutes => 0,
20
20
  :seconds => start_time.sec
21
21
  )
22
22
  when "DAILY"
23
23
  start_time.change(
24
24
  :hour => 0,
25
- :minutes => start_time.min,
25
+ :minutes => start_time.min,
26
26
  :seconds => start_time.sec
27
27
  )
28
28
  when "WEEKLY"
29
29
  start_of_week(time)
30
30
  when "MONTHLY"
31
31
  start_time.change(
32
- :day => 1,
33
- :hour => start_time.hour,
32
+ :day => 1,
33
+ :hour => start_time.hour,
34
34
  :minutes => start_time.min,
35
35
  :seconds => start_time.sec
36
36
  )
@@ -47,7 +47,7 @@ module RiCal
47
47
  start_time
48
48
  end
49
49
  end
50
-
50
+
51
51
  def enumerator(component) # :nodoc:
52
52
  Enumerator.for(self, component, by_list[:bysetpos])
53
53
  end
@@ -60,26 +60,26 @@ module RiCal
60
60
  case freq
61
61
  when "SECONDLY"
62
62
  [time1.year, time1.month, time1.day, time1.hour, time1.min, time1.sec] ==
63
- [time2.year, time2.month, time2.day, time2.hour, time2.min, time2.sec]
63
+ [time2.year, time2.month, time2.day, time2.hour, time2.min, time2.sec]
64
64
  when "MINUTELY"
65
65
  [time1.year, time1.month, time1.day, time1.hour, time1.min] ==
66
- [time2.year, time2.month, time2.day, time2.hour, time2.min]
66
+ [time2.year, time2.month, time2.day, time2.hour, time2.min]
67
67
  when "HOURLY"
68
68
  [time1.year, time1.month, time1.day, time1.hour] ==
69
- [time2.year, time2.month, time2.day, time2.hour]
69
+ [time2.year, time2.month, time2.day, time2.hour]
70
70
  when "DAILY"
71
71
  [time1.year, time1.month, time1.day] ==
72
- [time2.year, time2.month, time2.day]
72
+ [time2.year, time2.month, time2.day]
73
73
  when "WEEKLY"
74
74
  sow1 = start_of_week(time1)
75
75
  sow2 = start_of_week(time2)
76
76
  [sow1.year, sow1.month, sow1.day] ==
77
- [sow2.year, sow2.month, sow2.day]
77
+ [sow2.year, sow2.month, sow2.day]
78
78
  when "MONTHLY"
79
79
  [time1.year, time1.month] ==
80
- [time2.year, time2.month]
80
+ [time2.year, time2.month]
81
81
  when "YEARLY"
82
- time1.year == time2.year
82
+ time1.year == time2.year
83
83
  end
84
84
  end
85
85
 
@@ -90,7 +90,10 @@ module RiCal
90
90
  nil
91
91
  end
92
92
  end
93
-
93
+
94
+ def incrementer_from_start_time(start_time)
95
+ RecurrenceRule::OccurrenceIncrementer.from_rrule(self, start_time)
96
+ end
94
97
  end
95
98
  end
96
99
  end