class IcalImporter::Collector

Attributes

events[R]
recurrence_events[R]
single_events[R]

Public Class Methods

new(events) click to toggle source
# File lib/ical_importer/collector.rb, line 5
def initialize(events)
  @events = events
  @single_events = []
  @recurrence_events = []
end

Public Instance Methods

collect() click to toggle source
# File lib/ical_importer/collector.rb, line 11
def collect
  self.tap do
    recurrence_builder = RecurrenceEventBuilder.new
    single_events.tap do |c|
      events.each do |remote_event|
        c << Builder.new(remote_event, recurrence_builder).build
      end
      @recurrence_events = recurrence_builder.build.built_events.flatten.compact
      c.flatten!
      c.compact!
    end
  end
end