lib/ri_cal/calendar_occurrences.rb
# 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 occurrences(options={})
      occs = recurring_subcomponents.inject([]) do |memo, collection|
        _, components = collection
        recurrable(components).each do |component|
          instances = event_instances(component.uid, components).sort_by(&:dtstart)
          add_occurrences(memo, component, instances, options)
          add_instances(memo, instances, options)
        end
        memo
      end.sort{|a,b| a.dtstart <=> b.dtstart}
      options[:count] ? occs.first([options[:count],0].max) : occs
    end
def occurrences ( options = { } ) occs = recurring_subcomponents . inject ( [ ] ) do | memo , collection | _ , components = collection recurrable ( components ) . each do | component | instances = event_instances ( component . uid , components ) . sort_by ( & :dtstart ) add_occurrences ( memo , component , instances , options ) add_instances ( memo , instances , options ) end memo end . sort { | a , b | a . dtstart <=> b . dtstart } options [ :count ] ? occs . first ( [ options [ :count ] , 0 ] . max ) : occs end
Return occurrences for all recurrable subcomponents of a calendar
Return occurrences for all recurrable subcomponents of a calendar
options