Class: IcalImporter::RecurrenceEventBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/ical_importer/recurrence_event_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRecurrenceEventBuilder

Returns a new instance of RecurrenceEventBuilder.



4
5
6
7
# File 'lib/ical_importer/recurrence_event_builder.rb', line 4

def initialize
  @events_to_build = []
  @built_events = []
end

Instance Attribute Details

#built_eventsObject (readonly)

Returns the value of attribute built_events.



3
4
5
# File 'lib/ical_importer/recurrence_event_builder.rb', line 3

def built_events
  @built_events
end

#events_to_buildObject (readonly)

Returns the value of attribute events_to_build.



3
4
5
# File 'lib/ical_importer/recurrence_event_builder.rb', line 3

def events_to_build
  @events_to_build
end

Instance Method Details

#<<(event) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
# File 'lib/ical_importer/recurrence_event_builder.rb', line 9

def <<(event)
  raise ArgumentError, "Must be an Icalendar Event" unless event.is_a? Icalendar::Event
  @events_to_build << event
end

#buildObject



14
15
16
17
18
19
20
# File 'lib/ical_importer/recurrence_event_builder.rb', line 14

def build
  self.tap do
    events_to_build.each do |remote_event|
      @built_events << build_new_local_event(remote_event)
    end
  end
end