Class: IcalImporter::RecurrenceEventBuilder
- Inherits:
-
Object
- Object
- IcalImporter::RecurrenceEventBuilder
- Defined in:
- lib/ical_importer/recurrence_event_builder.rb
Instance Attribute Summary collapse
-
#built_events ⇒ Object
readonly
Returns the value of attribute built_events.
-
#events_to_build ⇒ Object
readonly
Returns the value of attribute events_to_build.
Instance Method Summary collapse
- #<<(event) ⇒ Object
- #build ⇒ Object
-
#initialize ⇒ RecurrenceEventBuilder
constructor
A new instance of RecurrenceEventBuilder.
Constructor Details
#initialize ⇒ RecurrenceEventBuilder
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_events ⇒ Object (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_build ⇒ Object (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
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 |
#build ⇒ Object
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 |