Class: IcalImporter::Builder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event, recurrence_builder) ⇒ Builder

Returns a new instance of Builder.



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

def initialize(event, recurrence_builder)
  @event = event
  @recurrence_builder = recurrence_builder
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



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

def event
  @event
end

#recurrence_builderObject (readonly)

Returns the value of attribute recurrence_builder.



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

def recurrence_builder
  @recurrence_builder
end

Instance Method Details

#buildObject



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

def build
  if handle_as_recurrence?
    recurrence_builder << event
    nil # Don't want this messing up our collect in Collector
  else
    SingleEventBuilder.new(event).build
  end
end

#handle_as_recurrence?Boolean

Returns:

  • (Boolean)


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

def handle_as_recurrence?
  event.recurrence_id.present?
end