<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>sample_ical_files/from_ical_dot_app/test1.ics</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -66,11 +66,13 @@ module RiCal
       !mutual_exclusion_violation
     end
     
-    # return the value of a property if it exists
-    # otherwise return nil
-    def value_of_property(property)
-      property ? property.value : nil
+    def recurrence(occurrence)
+      result = self.copy
     end
+    
+    def initialize_copy(original)
+    end
+    
   end
 end
 </diff>
      <filename>lib/ri_cal/component.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,10 @@ module RiCal
         def to_rfc2445_string
           to_s
         end
+        
+        def to_ruby_value
+          self
+        end
       end
     end
   end</diff>
      <filename>lib/ri_cal/core_extensions/object/conversions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,8 @@ module RiCal
   # OccurrenceEnumerator provides common methods for CalendarComponents that support recurrence
   # i.e. Event, Journal, Todo, and TimezonePeriod
   module OccurrenceEnumerator
+    
+    include Enumerable
 
     def default_duration     
       dtend &amp;&amp; dtstart.to_ri_cal_date_time_value.duration_until(dtend)
@@ -33,6 +35,7 @@ module RiCal
       
       def initialize(component, rules)
         self.enumerators = rules.map {|rrule| rrule.enumerator(component)}
+        @bounded = enumerators.all? {|enumerator| enumerator.bounded?}
         self.nexts = @enumerators.map {|enumerator| enumerator.next_occurrence}
       end
       
@@ -44,22 +47,74 @@ module RiCal
         end
         result
       end
+      
+      def bounded?
+        @bounded
+      end
     end
     
     # EnumerationInstance holds the values needed during the enumeration of occurrences for a component.
     class EnumerationInstance
-      def initialize(options, component)
+      include Enumerable
+      
+      def initialize(component, options = {})
         @component = component
         @start = options[:starting]
         @cutoff = options[:before]
-        @rrules = OccurrenceMerger.for(@component, @component.rrule)
-        @exrules = OccurrenceMerger.for(@component, @component.exrule)
+        @count = options[:count]
+        @rrules = OccurrenceMerger.for(@component, [@component.rrule_property, @component.rdate_property].flatten.compact)
+        @exrules = OccurrenceMerger.for(@component, [@component.exrule_property, @component.exdate_property].flatten.compact)
+      end
+      
+      # return the next exclusion which starts at the same time or after the start time of the occurrence
+      # return nil if this exhausts the exclusion rules
+      def exclusion_for(occurrence)
+        while (@next_exclusion &amp;&amp; @next_exclusion[:start] &lt; occurrence[:start])
+          @next_exclusion = @exrules.next_occurrence
+        end
+        @next_exclusion
+      end
+
+      # TODO: Need to research this, I beleive that this should also take the end time into account,
+      #       but I need to research
+      def exclusion_match?(occurrence, exclusion)
+        exclusion &amp;&amp; occurrence[:start] == occurrence[:start]
+      end
+      
+      def exclude?(occurrence)
+        exclusion_match?(occurrence, exclusion_for(occurrence))
       end
       
       # yield each occurrence to a block
       # some components may be open-ended, e.g. have no COUNT or DTEND 
-      def each_occurrence
+      def each
+        occurrence = @rrules.next_occurrence
+        yielded = 0
+        @next_exclusion = @exrules.next_occurrence
+        while (occurrence)
+          if (@cutoff &amp;&amp; occurrence[:start] &gt;= @cutoff) || (@count &amp;&amp; yielded &gt;= @count)
+            occurrence = nil
+          else
+            unless exclude?(occurrence)
+              yielded += 1
+              yield occurrence
+#              yield @component.recurrence(occurrence)
+            end
+            occurrence = @rrules.next_occurrence
+          end
+        end
+      end
+      
+      def bounded?
+        @rrules.bounded? || @count || @cutoff
       end
+      
+      def to_a
+        raise ArgumentError.new(&quot;This component is unbounded, cannot produce an array of occurrences!&quot;) unless bounded?
+        super
+      end
+      
+      alias_method :entries, :to_a
     end
     
     # return an array of occurrences according to the options parameter
@@ -68,7 +123,11 @@ module RiCal
     # * starting
     # * before
     def occurrences(options={})
-      EnumerationInstance.new(options, self).occurrences      
+      EnumerationInstance.new(self, options).to_a    
     end
+    
+    def each(&amp;block)
+      EnumerationInstance.new(self).each(&amp;block)
+    end     
   end
 end
\ No newline at end of file</diff>
      <filename>lib/ri_cal/occurrence_enumerator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,7 +29,7 @@ module RiCal
       # return the value of the ACTION property
       # which will be an instance of String
       def action
-        action_property ? action_property.value : property
+        action_property ? action_property.value : nil
       end
 
       def action_property_from_string(line) # :nodoc:
@@ -62,7 +62,7 @@ module RiCal
       # return the value of the DESCRIPTION property
       # which will be an instance of String
       def description
-        description_property ? description_property.value : property
+        description_property ? description_property.value : nil
       end
 
       def description_property_from_string(line) # :nodoc:
@@ -95,7 +95,7 @@ module RiCal
       # return the value of the TRIGGER property
       # which will be an instance of duration_or_utc_date_time
       def trigger
-        trigger_property ? trigger_property.value : property
+        trigger_property ? trigger_property.value : nil
       end
 
       def trigger_property_from_string(line) # :nodoc:
@@ -128,7 +128,7 @@ module RiCal
       # return the value of the DURATION property
       # which will be an instance of Duration
       def duration
-        duration_property ? duration_property.value : property
+        duration_property ? duration_property.value : nil
       end
 
       def duration_property_from_string(line) # :nodoc:
@@ -161,7 +161,7 @@ module RiCal
       # return the value of the REPEAT property
       # which will be an instance of Integer
       def repeat
-        repeat_property ? repeat_property.value : property
+        repeat_property ? repeat_property.value : nil
       end
 
       def repeat_property_from_string(line) # :nodoc:
@@ -194,7 +194,7 @@ module RiCal
       # return the value of the SUMMARY property
       # which will be an instance of String
       def summary
-        summary_property ? summary_property.value : property
+        summary_property ? summary_property.value : nil
       end
 
       def summary_property_from_string(line) # :nodoc:</diff>
      <filename>lib/ri_cal/properties/alarm.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,7 +18,7 @@ module RiCal
       # return the value of the CALSCALE property
       # which will be an instance of String
       def calscale
-        calscale_property ? calscale_property.value : property
+        calscale_property ? calscale_property.value : nil
       end
 
       def calscale_property_from_string(line) # :nodoc:
@@ -51,7 +51,7 @@ module RiCal
       # return the value of the METHOD property
       # which will be an instance of String
       def icalendar_method
-        method_property ? method_property.value : property
+        method_property ? method_property.value : nil
       end
 
       def method_property_from_string(line) # :nodoc:
@@ -84,7 +84,7 @@ module RiCal
       # return the value of the PRODID property
       # which will be an instance of String
       def prodid
-        prodid_property ? prodid_property.value : property
+        prodid_property ? prodid_property.value : nil
       end
 
       def prodid_property_from_string(line) # :nodoc:
@@ -106,7 +106,7 @@ module RiCal
       # return the value of the VERSION property
       # which will be an instance of String
       def version
-        version_property ? version_property.value : property
+        version_property ? version_property.value : nil
       end
 
       def version_property_from_string(line) # :nodoc:</diff>
      <filename>lib/ri_cal/properties/calendar.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,7 +29,7 @@ module RiCal
       # return the value of the CLASS property
       # which will be an instance of String
       def security_class
-        class_property ? class_property.value : property
+        class_property ? class_property.value : nil
       end
 
       def class_property_from_string(line) # :nodoc:
@@ -62,7 +62,7 @@ module RiCal
       # return the value of the CREATED property
       # which will be an instance of DateTime
       def created
-        created_property ? created_property.value : property
+        created_property ? created_property.value : nil
       end
 
       def created_property_from_string(line) # :nodoc:
@@ -95,7 +95,7 @@ module RiCal
       # return the value of the DESCRIPTION property
       # which will be an instance of String
       def description
-        description_property ? description_property.value : property
+        description_property ? description_property.value : nil
       end
 
       def description_property_from_string(line) # :nodoc:
@@ -128,7 +128,7 @@ module RiCal
       # return the value of the DTSTART property
       # which will be an instance of either DateTime or Date
       def dtstart
-        dtstart_property ? dtstart_property.value : property
+        dtstart_property ? dtstart_property.value : nil
       end
 
       def dtstart_property_from_string(line) # :nodoc:
@@ -161,7 +161,7 @@ module RiCal
       # return the value of the GEO property
       # which will be an instance of Geo
       def geo
-        geo_property ? geo_property.value : property
+        geo_property ? geo_property.value : nil
       end
 
       def geo_property_from_string(line) # :nodoc:
@@ -194,7 +194,7 @@ module RiCal
       # return the value of the LAST-MODIFIED property
       # which will be an instance of DateTime
       def last_modified
-        last_modified_property ? last_modified_property.value : property
+        last_modified_property ? last_modified_property.value : nil
       end
 
       def last_modified_property_from_string(line) # :nodoc:
@@ -227,7 +227,7 @@ module RiCal
       # return the value of the LOCATION property
       # which will be an instance of String
       def location
-        location_property ? location_property.value : property
+        location_property ? location_property.value : nil
       end
 
       def location_property_from_string(line) # :nodoc:
@@ -260,7 +260,7 @@ module RiCal
       # return the value of the ORGANIZER property
       # which will be an instance of CalAddress
       def organizer
-        organizer_property ? organizer_property.value : property
+        organizer_property ? organizer_property.value : nil
       end
 
       def organizer_property_from_string(line) # :nodoc:
@@ -293,7 +293,7 @@ module RiCal
       # return the value of the PRIORITY property
       # which will be an instance of Integer
       def priority
-        priority_property ? priority_property.value : property
+        priority_property ? priority_property.value : nil
       end
 
       def priority_property_from_string(line) # :nodoc:
@@ -326,7 +326,7 @@ module RiCal
       # return the value of the DTSTAMP property
       # which will be an instance of DateTime
       def dtstamp
-        dtstamp_property ? dtstamp_property.value : property
+        dtstamp_property ? dtstamp_property.value : nil
       end
 
       def dtstamp_property_from_string(line) # :nodoc:
@@ -359,7 +359,7 @@ module RiCal
       # return the value of the SEQUENCE property
       # which will be an instance of Integer
       def sequence
-        sequence_property ? sequence_property.value : property
+        sequence_property ? sequence_property.value : nil
       end
 
       def sequence_property_from_string(line) # :nodoc:
@@ -392,7 +392,7 @@ module RiCal
       # return the value of the STATUS property
       # which will be an instance of String
       def status
-        status_property ? status_property.value : property
+        status_property ? status_property.value : nil
       end
 
       def status_property_from_string(line) # :nodoc:
@@ -425,7 +425,7 @@ module RiCal
       # return the value of the SUMMARY property
       # which will be an instance of String
       def summary
-        summary_property ? summary_property.value : property
+        summary_property ? summary_property.value : nil
       end
 
       def summary_property_from_string(line) # :nodoc:
@@ -458,7 +458,7 @@ module RiCal
       # return the value of the TRANSP property
       # which will be an instance of String
       def transp
-        transp_property ? transp_property.value : property
+        transp_property ? transp_property.value : nil
       end
 
       def transp_property_from_string(line) # :nodoc:
@@ -491,7 +491,7 @@ module RiCal
       # return the value of the UID property
       # which will be an instance of String
       def uid
-        uid_property ? uid_property.value : property
+        uid_property ? uid_property.value : nil
       end
 
       def uid_property_from_string(line) # :nodoc:
@@ -524,7 +524,7 @@ module RiCal
       # return the value of the URL property
       # which will be an instance of Uri
       def url
-        url_property ? url_property.value : property
+        url_property ? url_property.value : nil
       end
 
       def url_property_from_string(line) # :nodoc:
@@ -557,7 +557,7 @@ module RiCal
       # return the value of the RECURRENCE-ID property
       # which will be an instance of either DateTime or Date
       def recurrence_id
-        recurrence_id_property ? recurrence_id_property.value : property
+        recurrence_id_property ? recurrence_id_property.value : nil
       end
 
       def recurrence_id_property_from_string(line) # :nodoc:
@@ -591,7 +591,7 @@ module RiCal
       # return the value of the DTEND property
       # which will be an instance of either DateTime or Date
       def dtend
-        dtend_property ? dtend_property.value : property
+        dtend_property ? dtend_property.value : nil
       end
 
       def dtend_property_from_string(line) # :nodoc:
@@ -625,7 +625,7 @@ module RiCal
       # return the value of the DURATION property
       # which will be an instance of Duration
       def duration
-        duration_property ? duration_property.value : property
+        duration_property ? duration_property.value : nil
       end
 
       def duration_property_from_string(line) # :nodoc:</diff>
      <filename>lib/ri_cal/properties/event.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,7 +29,7 @@ module RiCal
       # return the value of the CONTACT property
       # which will be an instance of String
       def contact
-        contact_property ? contact_property.value : property
+        contact_property ? contact_property.value : nil
       end
 
       def contact_property_from_string(line) # :nodoc:
@@ -62,7 +62,7 @@ module RiCal
       # return the value of the DTSTART property
       # which will be an instance of either DateTime or Date
       def dtstart
-        dtstart_property ? dtstart_property.value : property
+        dtstart_property ? dtstart_property.value : nil
       end
 
       def dtstart_property_from_string(line) # :nodoc:
@@ -95,7 +95,7 @@ module RiCal
       # return the value of the DTEND property
       # which will be an instance of either DateTime or Date
       def dtend
-        dtend_property ? dtend_property.value : property
+        dtend_property ? dtend_property.value : nil
       end
 
       def dtend_property_from_string(line) # :nodoc:
@@ -128,7 +128,7 @@ module RiCal
       # return the value of the DURATION property
       # which will be an instance of Duration
       def duration
-        duration_property ? duration_property.value : property
+        duration_property ? duration_property.value : nil
       end
 
       def duration_property_from_string(line) # :nodoc:
@@ -161,7 +161,7 @@ module RiCal
       # return the value of the DTSTAMP property
       # which will be an instance of DateTime
       def dtstamp
-        dtstamp_property ? dtstamp_property.value : property
+        dtstamp_property ? dtstamp_property.value : nil
       end
 
       def dtstamp_property_from_string(line) # :nodoc:
@@ -194,7 +194,7 @@ module RiCal
       # return the value of the ORGANIZER property
       # which will be an instance of CalAddress
       def organizer
-        organizer_property ? organizer_property.value : property
+        organizer_property ? organizer_property.value : nil
       end
 
       def organizer_property_from_string(line) # :nodoc:
@@ -227,7 +227,7 @@ module RiCal
       # return the value of the UID property
       # which will be an instance of String
       def uid
-        uid_property ? uid_property.value : property
+        uid_property ? uid_property.value : nil
       end
 
       def uid_property_from_string(line) # :nodoc:
@@ -260,7 +260,7 @@ module RiCal
       # return the value of the URL property
       # which will be an instance of Uri
       def url
-        url_property ? url_property.value : property
+        url_property ? url_property.value : nil
       end
 
       def url_property_from_string(line) # :nodoc:</diff>
      <filename>lib/ri_cal/properties/freebusy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,7 +29,7 @@ module RiCal
       # return the value of the CLASS property
       # which will be an instance of String
       def security_class
-        class_property ? class_property.value : property
+        class_property ? class_property.value : nil
       end
 
       def class_property_from_string(line) # :nodoc:
@@ -62,7 +62,7 @@ module RiCal
       # return the value of the CREATED property
       # which will be an instance of DateTime
       def created
-        created_property ? created_property.value : property
+        created_property ? created_property.value : nil
       end
 
       def created_property_from_string(line) # :nodoc:
@@ -95,7 +95,7 @@ module RiCal
       # return the value of the DESCRIPTION property
       # which will be an instance of String
       def description
-        description_property ? description_property.value : property
+        description_property ? description_property.value : nil
       end
 
       def description_property_from_string(line) # :nodoc:
@@ -128,7 +128,7 @@ module RiCal
       # return the value of the DTSTART property
       # which will be an instance of either DateTime or Date
       def dtstart
-        dtstart_property ? dtstart_property.value : property
+        dtstart_property ? dtstart_property.value : nil
       end
 
       def dtstart_property_from_string(line) # :nodoc:
@@ -161,7 +161,7 @@ module RiCal
       # return the value of the DTSTAMP property
       # which will be an instance of DateTime
       def dtstamp
-        dtstamp_property ? dtstamp_property.value : property
+        dtstamp_property ? dtstamp_property.value : nil
       end
 
       def dtstamp_property_from_string(line) # :nodoc:
@@ -194,7 +194,7 @@ module RiCal
       # return the value of the LAST-MODIFIED property
       # which will be an instance of DateTime
       def last_modified
-        last_modified_property ? last_modified_property.value : property
+        last_modified_property ? last_modified_property.value : nil
       end
 
       def last_modified_property_from_string(line) # :nodoc:
@@ -227,7 +227,7 @@ module RiCal
       # return the value of the ORGANIZER property
       # which will be an instance of CalAddress
       def organizer
-        organizer_property ? organizer_property.value : property
+        organizer_property ? organizer_property.value : nil
       end
 
       def organizer_property_from_string(line) # :nodoc:
@@ -260,7 +260,7 @@ module RiCal
       # return the value of the RECURRENCE-ID property
       # which will be an instance of either DateTime or Date
       def recurrence_id
-        recurrence_id_property ? recurrence_id_property.value : property
+        recurrence_id_property ? recurrence_id_property.value : nil
       end
 
       def recurrence_id_property_from_string(line) # :nodoc:
@@ -293,7 +293,7 @@ module RiCal
       # return the value of the SEQUENCE property
       # which will be an instance of Integer
       def sequence
-        sequence_property ? sequence_property.value : property
+        sequence_property ? sequence_property.value : nil
       end
 
       def sequence_property_from_string(line) # :nodoc:
@@ -326,7 +326,7 @@ module RiCal
       # return the value of the STATUS property
       # which will be an instance of String
       def status
-        status_property ? status_property.value : property
+        status_property ? status_property.value : nil
       end
 
       def status_property_from_string(line) # :nodoc:
@@ -359,7 +359,7 @@ module RiCal
       # return the value of the SUMMARY property
       # which will be an instance of String
       def summary
-        summary_property ? summary_property.value : property
+        summary_property ? summary_property.value : nil
       end
 
       def summary_property_from_string(line) # :nodoc:
@@ -392,7 +392,7 @@ module RiCal
       # return the value of the UID property
       # which will be an instance of String
       def uid
-        uid_property ? uid_property.value : property
+        uid_property ? uid_property.value : nil
       end
 
       def uid_property_from_string(line) # :nodoc:
@@ -425,7 +425,7 @@ module RiCal
       # return the value of the URL property
       # which will be an instance of Uri
       def url
-        url_property ? url_property.value : property
+        url_property ? url_property.value : nil
       end
 
       def url_property_from_string(line) # :nodoc:</diff>
      <filename>lib/ri_cal/properties/journal.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,7 +29,7 @@ module RiCal
       # return the value of the DTSTART property
       # which will be an instance of either DateTime or Date
       def dtstart
-        dtstart_property ? dtstart_property.value : property
+        dtstart_property ? dtstart_property.value : nil
       end
 
       def dtstart_property_from_string(line) # :nodoc:
@@ -62,7 +62,7 @@ module RiCal
       # return the value of the TZOFFSETTO property
       # which will be an instance of UtcOffset
       def tzoffsetto
-        tzoffsetto_property ? tzoffsetto_property.value : property
+        tzoffsetto_property ? tzoffsetto_property.value : nil
       end
 
       def tzoffsetto_property_from_string(line) # :nodoc:
@@ -95,7 +95,7 @@ module RiCal
       # return the value of the TZOFFSETFROM property
       # which will be an instance of UtcOffset
       def tzoffsetfrom
-        tzoffsetfrom_property ? tzoffsetfrom_property.value : property
+        tzoffsetfrom_property ? tzoffsetfrom_property.value : nil
       end
 
       def tzoffsetfrom_property_from_string(line) # :nodoc:</diff>
      <filename>lib/ri_cal/properties/timezone_period.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,7 +29,7 @@ module RiCal
       # return the value of the CLASS property
       # which will be an instance of String
       def security_class
-        class_property ? class_property.value : property
+        class_property ? class_property.value : nil
       end
 
       def class_property_from_string(line) # :nodoc:
@@ -62,7 +62,7 @@ module RiCal
       # return the value of the COMPLETED property
       # which will be an instance of DateTime
       def completed
-        completed_property ? completed_property.value : property
+        completed_property ? completed_property.value : nil
       end
 
       def completed_property_from_string(line) # :nodoc:
@@ -95,7 +95,7 @@ module RiCal
       # return the value of the CREATED property
       # which will be an instance of DateTime
       def created
-        created_property ? created_property.value : property
+        created_property ? created_property.value : nil
       end
 
       def created_property_from_string(line) # :nodoc:
@@ -128,7 +128,7 @@ module RiCal
       # return the value of the DESCRIPTION property
       # which will be an instance of String
       def description
-        description_property ? description_property.value : property
+        description_property ? description_property.value : nil
       end
 
       def description_property_from_string(line) # :nodoc:
@@ -161,7 +161,7 @@ module RiCal
       # return the value of the DTSTAMP property
       # which will be an instance of DateTime
       def dtstamp
-        dtstamp_property ? dtstamp_property.value : property
+        dtstamp_property ? dtstamp_property.value : nil
       end
 
       def dtstamp_property_from_string(line) # :nodoc:
@@ -194,7 +194,7 @@ module RiCal
       # return the value of the DTSTART property
       # which will be an instance of either DateTime or Date
       def dtstart
-        dtstart_property ? dtstart_property.value : property
+        dtstart_property ? dtstart_property.value : nil
       end
 
       def dtstart_property_from_string(line) # :nodoc:
@@ -227,7 +227,7 @@ module RiCal
       # return the value of the GEO property
       # which will be an instance of Geo
       def geo
-        geo_property ? geo_property.value : property
+        geo_property ? geo_property.value : nil
       end
 
       def geo_property_from_string(line) # :nodoc:
@@ -260,7 +260,7 @@ module RiCal
       # return the value of the LAST-MODIFIED property
       # which will be an instance of DateTime
       def last_modified
-        last_modified_property ? last_modified_property.value : property
+        last_modified_property ? last_modified_property.value : nil
       end
 
       def last_modified_property_from_string(line) # :nodoc:
@@ -293,7 +293,7 @@ module RiCal
       # return the value of the LOCATION property
       # which will be an instance of String
       def location
-        location_property ? location_property.value : property
+        location_property ? location_property.value : nil
       end
 
       def location_property_from_string(line) # :nodoc:
@@ -326,7 +326,7 @@ module RiCal
       # return the value of the ORGANIZER property
       # which will be an instance of CalAddress
       def organizer
-        organizer_property ? organizer_property.value : property
+        organizer_property ? organizer_property.value : nil
       end
 
       def organizer_property_from_string(line) # :nodoc:
@@ -359,7 +359,7 @@ module RiCal
       # return the value of the PERCENT-COMPLETE property
       # which will be an instance of Integer
       def percent_complete
-        percent_complete_property ? percent_complete_property.value : property
+        percent_complete_property ? percent_complete_property.value : nil
       end
 
       def percent_complete_property_from_string(line) # :nodoc:
@@ -392,7 +392,7 @@ module RiCal
       # return the value of the PRIORITY property
       # which will be an instance of Integer
       def priority
-        priority_property ? priority_property.value : property
+        priority_property ? priority_property.value : nil
       end
 
       def priority_property_from_string(line) # :nodoc:
@@ -425,7 +425,7 @@ module RiCal
       # return the value of the RECURRENCE-ID property
       # which will be an instance of either DateTime or Date
       def recurrence_id
-        recurrence_id_property ? recurrence_id_property.value : property
+        recurrence_id_property ? recurrence_id_property.value : nil
       end
 
       def recurrence_id_property_from_string(line) # :nodoc:
@@ -458,7 +458,7 @@ module RiCal
       # return the value of the SEQUENCE property
       # which will be an instance of Integer
       def sequence
-        sequence_property ? sequence_property.value : property
+        sequence_property ? sequence_property.value : nil
       end
 
       def sequence_property_from_string(line) # :nodoc:
@@ -491,7 +491,7 @@ module RiCal
       # return the value of the STATUS property
       # which will be an instance of String
       def status
-        status_property ? status_property.value : property
+        status_property ? status_property.value : nil
       end
 
       def status_property_from_string(line) # :nodoc:
@@ -524,7 +524,7 @@ module RiCal
       # return the value of the SUMMARY property
       # which will be an instance of String
       def summary
-        summary_property ? summary_property.value : property
+        summary_property ? summary_property.value : nil
       end
 
       def summary_property_from_string(line) # :nodoc:
@@ -557,7 +557,7 @@ module RiCal
       # return the value of the UID property
       # which will be an instance of String
       def uid
-        uid_property ? uid_property.value : property
+        uid_property ? uid_property.value : nil
       end
 
       def uid_property_from_string(line) # :nodoc:
@@ -590,7 +590,7 @@ module RiCal
       # return the value of the URL property
       # which will be an instance of Uri
       def url
-        url_property ? url_property.value : property
+        url_property ? url_property.value : nil
       end
 
       def url_property_from_string(line) # :nodoc:
@@ -624,7 +624,7 @@ module RiCal
       # return the value of the DUE property
       # which will be an instance of either DateTime or Date
       def due
-        due_property ? due_property.value : property
+        due_property ? due_property.value : nil
       end
 
       def due_property_from_string(line) # :nodoc:
@@ -658,7 +658,7 @@ module RiCal
       # return the value of the DURATION property
       # which will be an instance of Duration
       def duration
-        duration_property ? duration_property.value : property
+        duration_property ? duration_property.value : nil
       end
 
       def duration_property_from_string(line) # :nodoc:</diff>
      <filename>lib/ri_cal/properties/todo.rb</filename>
    </modified>
    <modified>
      <diff>@@ -133,6 +133,10 @@ module RiCal
       def to_datetime
         @date_time_value
       end
+      
+      def to_ruby_value
+        to_datetime
+      end
 
       alias_method :ruby_value, :to_datetime
 </diff>
      <filename>lib/ri_cal/property_value/date_time.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,11 +3,11 @@ module RiCal
     class OccurrenceList &lt; Array
       class Enumerator
 
-        attr_accessor :default_duration
+        attr_accessor :default_duration, :occurrence_list
 
         # TODO: the component parameter should always be the parent
-        def initialize(occurrence_list_value, component)
-          self.occurrence_list = occurrence_list_value
+        def initialize(occurrences, component)
+          self.occurrence_list = occurrences
           self.default_duration = component.default_duration
           @index = 0
         end
@@ -34,5 +34,9 @@ module RiCal
         end
       end
     end
+    
+    def enumerator(component)
+      OccurrenceList::Enumerator.new(@elements, component)
+    end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/ri_cal/property_value/occurrence_list.rb</filename>
    </modified>
    <modified>
      <diff>@@ -277,6 +277,10 @@ module RiCal
       def exhausted?(count, time)
         (@count &amp;&amp; count &gt; @count) || (@until &amp;&amp; (time &gt; @until))
       end
+      
+      def bounded?
+        @count || @until
+      end
 
       def start_of_week(time)
         time.advance(:days =&gt; - (wkst_day - time.wday + 7) % 7)</diff>
      <filename>lib/ri_cal/property_value/recurrence_rule.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,7 @@ module RiCal
           self.start_time = component.default_start_time
           self.duration = component.default_duration
           self.next_time = recurrence_rule.adjust_start(self.start_time)
+          @bounded = recurrence_rule.bounded?
           @count = 0
           @setpos_list = setpos_list
           @setpos = 1
@@ -19,6 +20,10 @@ module RiCal
           @reset_month = recurrence_rule.reset_month || start_time.month
           @next_occurrence_count = 0
         end
+        
+        def bounded?
+          @bounded
+        end
 
         def result_hash(date_time_value)
           {:start =&gt; date_time_value, :end =&gt; nil}</diff>
      <filename>lib/ri_cal/property_value/recurrence_rule/enumerator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,79 @@
 require File.join(File.dirname(__FILE__), %w[.. spec_helper])
 
+# Note that this is more of a functional spec
 describe RiCal::OccurrenceEnumerator do
   
+  Fr13Unbounded_Zulu = &lt;&lt;-TEXT
+BEGIN:VEVENT
+DTSTART:19970902T090000Z
+EXDATE:19970902T090000Z
+RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13
+END:VEVENT
+TEXT
+
+ Fr13Unbounded_Eastern = &lt;&lt;-TEXT
+BEGIN:VEVENT
+DTSTART;TZID=US-Eastern:19970902T090000
+EXDATE;TZID=US-Eastern:19970902T090000
+RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13
+END:VEVENT
+TEXT
+  
+  describe &quot;.occurrences&quot; do
+    describe &quot;with an unbounded component&quot; do
+      before(:each) do
+        @it = RiCal.parse_string(Fr13Unbounded_Zulu).first
+        @expected_five = [
+          &quot;2/13/1998 9:00 AM  UTC&quot;,
+          &quot;3/13/1998 9:00 AM  UTC&quot;,
+          &quot;11/13/1998 9:00 AM UTC&quot;,
+          &quot;8/13/1999 9:00 AM  UTC&quot;,
+          &quot;10/13/2000 9:00 AM UTC&quot;,
+          ].map {|s| DateTime.parse(s)}
+      end
+      
+      it &quot;should raise an ArgumentError with no options to limit result&quot; do
+        lambda {@it.occurrences}.should raise_error(ArgumentError)
+      end
+      
+      it &quot;should have the right five occurrences when :count =&gt; 5 option is used&quot; do
+        @it.occurrences(:count =&gt; 5).map {|occ| occ[:start].to_ruby_value}.should == @expected_five
+      end
+      
+    end
+  end
+    
+
+  describe &quot;.each&quot; do
+    describe &quot; for Every Friday the 13th, forever&quot; do
+      before(:each) do
+        event = RiCal.parse_string(Fr13Unbounded_Zulu).first
+        @result = []
+        event.each do |occurrence|
+          break if @result.length &gt;= 5
+          @result &lt;&lt; occurrence[:start].to_ruby_value
+        end
+      end
+
+      it &quot;should have the right first six occurrences&quot; do
+        # TODO - Need to properly deal with timezones
+        expected = [
+          # &quot;2/13/1998 9:00 AM EST&quot;,
+          # &quot;3/13/1998 9:00 AM EST&quot;,
+          # &quot;11/13/1998 9:00 AM EST&quot;,
+          # &quot;8/13/1999 9:00 AM EDT&quot;,
+          # &quot;10/13/2000 9:00 AM EST&quot;,
+          &quot;2/13/1998 9:00 AM  UTC&quot;,
+          &quot;3/13/1998 9:00 AM  UTC&quot;,
+          &quot;11/13/1998 9:00 AM UTC&quot;,
+          &quot;8/13/1999 9:00 AM  UTC&quot;,
+          &quot;10/13/2000 9:00 AM UTC&quot;,
+          ].map {|s| DateTime.parse(s)}
+        @result.should == expected
+      end
+
+    end
+  end
 end
 
 describe RiCal::OccurrenceEnumerator::OccurrenceMerger do
@@ -37,8 +109,8 @@ describe RiCal::OccurrenceEnumerator::OccurrenceMerger do
     describe &quot;with multiple rrules&quot; do
       before(:each) do
         @component = mock(&quot;component&quot;, :dtstart =&gt; :dtstart_value)
-        @enum1 = mock(&quot;rrule_enumerator1&quot;, :next_occurrence =&gt; :occ1)
-        @enum2 = mock(&quot;rrule_enumerator2&quot;, :next_occurrence =&gt; :occ2)
+        @enum1 = mock(&quot;rrule_enumerator1&quot;, :next_occurrence =&gt; :occ1, :bounded? =&gt; true)
+        @enum2 = mock(&quot;rrule_enumerator2&quot;, :next_occurrence =&gt; :occ2, :bounded? =&gt; true)
         @rrule1 = mock(&quot;rrule&quot;, :enumerator =&gt; @enum1)
         @rrule2 = mock(&quot;rrule&quot;, :enumerator =&gt; @enum2)
       end
@@ -48,8 +120,8 @@ describe RiCal::OccurrenceEnumerator::OccurrenceMerger do
       end
       
       it &quot;should pass the component to the enumerator instantiation&quot; do
-        @rrule1.should_receive(:enumerator).with(@component)
-        @rrule2.should_receive(:enumerator).with(@component)
+        @rrule1.should_receive(:enumerator).with(@component).and_return(@enum1)
+        @rrule2.should_receive(:enumerator).with(@component).and_return(@enum2)
         @merger.for(@component, [@rrule1, @rrule2])
       end
       
@@ -65,8 +137,8 @@ describe RiCal::OccurrenceEnumerator::OccurrenceMerger do
 
     describe &quot;with unique nexts&quot; do
       before(:each) do
-        @enum1 = mock(&quot;rrule_enumerator1&quot;, :next_occurrence =&gt; 3)
-        @enum2 = mock(&quot;rrule_enumerator2&quot;, :next_occurrence =&gt; 2)
+        @enum1 = mock(&quot;rrule_enumerator1&quot;, :next_occurrence =&gt; 3, :bounded? =&gt; true)
+        @enum2 = mock(&quot;rrule_enumerator2&quot;, :next_occurrence =&gt; 2, :bounded? =&gt; true)
         @rrule1 = mock(&quot;rrule&quot;, :enumerator =&gt; @enum1)
         @rrule2 = mock(&quot;rrule&quot;, :enumerator =&gt; @enum2)
         @it = @merger.new(0, [@rrule1, @rrule2])
@@ -95,8 +167,8 @@ describe RiCal::OccurrenceEnumerator::OccurrenceMerger do
     
     describe &quot;with duplicated nexts&quot; do
       before(:each) do
-        @enum1 = mock(&quot;rrule_enumerator1&quot;, :next_occurrence =&gt; 2)
-        @enum2 = mock(&quot;rrule_enumerator2&quot;, :next_occurrence =&gt; 2)
+        @enum1 = mock(&quot;rrule_enumerator1&quot;, :next_occurrence =&gt; 2, :bounded? =&gt; true)
+        @enum2 = mock(&quot;rrule_enumerator2&quot;, :next_occurrence =&gt; 2, :bounded? =&gt; true)
         @rrule1 = mock(&quot;rrule&quot;, :enumerator =&gt; @enum1)
         @rrule2 = mock(&quot;rrule&quot;, :enumerator =&gt; @enum2)
         @it = @merger.new(0, [@rrule1, @rrule2])
@@ -123,8 +195,8 @@ describe RiCal::OccurrenceEnumerator::OccurrenceMerger do
     
     describe &quot;with all enumerators at end&quot; do
       before(:each) do
-        @enum1 = mock(&quot;rrule_enumerator1&quot;, :next_occurrence =&gt; nil)
-        @enum2 = mock(&quot;rrule_enumerator2&quot;, :next_occurrence =&gt; nil)
+        @enum1 = mock(&quot;rrule_enumerator1&quot;, :next_occurrence =&gt; nil, :bounded? =&gt; true)
+        @enum2 = mock(&quot;rrule_enumerator2&quot;, :next_occurrence =&gt; nil, :bounded? =&gt; true)
         @rrule1 = mock(&quot;rrule&quot;, :enumerator =&gt; @enum1)
         @rrule2 = mock(&quot;rrule&quot;, :enumerator =&gt; @enum2)
         @it = @merger.new(0, [@rrule1, @rrule2])</diff>
      <filename>spec/ri_cal/occurrence_enumerator_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,8 @@
 require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib ri_cal]))
+require 'cgi'
 
 module Kernel
   def rputs(*args)
-    puts *[&quot;&lt;pre&gt;&quot;, args.collect {|a| CGI.escapeHTML(a.inspect)}, &quot;&lt;/pre&gt;&quot;]
+    puts *[&quot;&lt;pre&gt;&quot;, args.collect {|a| CGI.escapeHTML(a.to_s)}, &quot;&lt;/pre&gt;&quot;]
   end
 end</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,7 @@ class VEntityUpdater
     @indent = &quot;&quot;
     @property_map = {}
     @property_defs = YAML.load_file(defs_file)
+    @all_props = []
   end
   
   def property(prop_name_or_hash)
@@ -111,6 +112,7 @@ class VEntityUpdater
   end
   
   def named_property(name, options)
+    @all_props &lt;&lt; name
     ruby_name = options['ruby_name']
     multi = options['multi']
     type = options['type']
@@ -208,7 +210,7 @@ class VEntityUpdater
       comment(&quot;return the value of the #{name.upcase} property&quot;)
       comment(&quot;which will be an instance of #{describe_type(type)}&quot;)
       indent(&quot;def #{ruby_name.downcase}&quot;)
-      indent(&quot;  #{property} ? #{property}.value : property&quot;)
+      indent(&quot;  #{property} ? #{property}.value : nil&quot;)
       indent(&quot;end&quot;)
       blank_line
       no_doc(&quot;def #{property}_from_string(line)&quot;)
@@ -231,6 +233,13 @@ class VEntityUpdater
 
   def generate_support_methods
     blank_line
+    indent(&quot;def initialize_copy(o)&quot;)
+    indent(&quot;  super&quot;)
+    @all_props.each do |prop_name|
+      indent(&quot;  @#{prop_name}_property = @{prop_name}_property.dup&quot;)
+    end
+    indent(&quot;end&quot;)
+    blank_line
     indent(&quot;module ClassMethods&quot;)
     indent(&quot;  def property_parser&quot;)
     indent(&quot;    #{@property_map.inspect}&quot;)</diff>
      <filename>tasks/ri_cal.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>046e17936678e58bf5b988e85c9a03025489f697</id>
    </parent>
  </parents>
  <author>
    <name>Rick DeNatale</name>
    <email>rick.denatale@gmail.com</email>
  </author>
  <url>http://github.com/kjwierenga/ri_cal/commit/fd5e54878df94ada6be5215f6690ad59b18d3386</url>
  <id>fd5e54878df94ada6be5215f6690ad59b18d3386</id>
  <committed-date>2009-02-25T10:43:50-08:00</committed-date>
  <authored-date>2009-02-25T10:43:50-08:00</authored-date>
  <message>occurrence enumeration producing hashes</message>
  <tree>48319a80733dc7b8c6f25fe985ebe25274a966a3</tree>
  <committer>
    <name>Rick DeNatale</name>
    <email>rick.denatale@gmail.com</email>
  </committer>
</commit>
