Class: IcalImporter::Collector
- Inherits:
-
Object
- Object
- IcalImporter::Collector
- Defined in:
- lib/ical_importer/collector.rb
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#recurrence_events ⇒ Object
readonly
Returns the value of attribute recurrence_events.
-
#single_events ⇒ Object
readonly
Returns the value of attribute single_events.
Instance Method Summary collapse
- #collect ⇒ Object
-
#initialize(events) ⇒ Collector
constructor
A new instance of Collector.
Constructor Details
#initialize(events) ⇒ Collector
Returns a new instance of Collector.
5 6 7 8 9 |
# File 'lib/ical_importer/collector.rb', line 5 def initialize(events) @events = events @single_events = [] @recurrence_events = [] end |
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
3 4 5 |
# File 'lib/ical_importer/collector.rb', line 3 def events @events end |
#recurrence_events ⇒ Object (readonly)
Returns the value of attribute recurrence_events.
3 4 5 |
# File 'lib/ical_importer/collector.rb', line 3 def recurrence_events @recurrence_events end |
#single_events ⇒ Object (readonly)
Returns the value of attribute single_events.
3 4 5 |
# File 'lib/ical_importer/collector.rb', line 3 def single_events @single_events end |
Instance Method Details
#collect ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# 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 |