lib/ri_cal/calendar_occurrences.rb
def add_occurrences(memo, component, instances, options)
      unless component.bounded?(options)
        raise ArgumentError.new("This component is unbounded, cannot enumerate occurrences!")
      end

      found_occurrences = 0
      found_instances   = 0
      
      # enumerate occurrences of the recurring component
      component.each(options.reject{|k,_|:count == k}) do |occurrence|
        break if found_occurrences >= options[:count] if options[:count]
        break if found_instances   >= options[:count] if options[:count]

        if instance = next_instance(instances, occurrence)
          if instance.occurrences(options).first
            memo << instance
            found_instances += 1
          end
        else
          memo << occurrence
          found_occurrences += 1
        end
      end
    end
# Return occurrences for all recurrable subcomponents of a calendar
Return occurrences for all recurrable subcomponents of a calendar
Return occurrences for all recurrable subcomponents of a calendar
def add_occurrences(memo, component, instances, options)
      unless component.bounded?(options)
        raise ArgumentError.new("This component is unbounded, cannot enumerate occurrences!")
      end
      found_occurrences = 0
      found_instances   = 0
      component.each(options.reject{|k,_|:count == k}) do |occurrence|
        break if found_occurrences >= options[:count] if options[:count]
        break if found_instances   >= options[:count] if options[:count]
        if instance = next_instance(instances, occurrence)
          if instance.occurrences(options).first
            memo << instance
            found_instances += 1
          end
        else
          memo << occurrence
          found_occurrences += 1
        end
      end
    end
def add_occurrences ( memo , component , instances , options ) unless component . bounded? ( options ) raise ArgumentError . new ( "This component is unbounded, cannot enumerate occurrences!" ) end found_occurrences = 0 found_instances = 0 component . each ( options . reject { | k , _ | :count == k } ) do | occurrence | break if found_occurrences >= options [ :count ] if options [ :count ] break if found_instances >= options [ :count ] if options [ :count ] if instance = next_instance ( instances , occurrence ) if instance . occurrences ( options ) . first memo << instance found_instances += 1 end else memo << occurrence found_occurrences += 1 end end end
Return occurrences for all recurrable subcomponents of a calendar
Return occurrences for all recurrable subcomponents of a calendar
# enumerate occurrences of the recurring component
memo
component
instances
options