class Almanack::Representation::BuiltIcalEvent
Attributes
event[R]
Public Class Methods
for(event)
click to toggle source
# File lib/almanack/representation/built_ical_event.rb, line 14 def self.for(event) new(event).ical_event end
new(event)
click to toggle source
# File lib/almanack/representation/built_ical_event.rb, line 6 def initialize(event) @event = event end
Public Instance Methods
ical_event()
click to toggle source
# File lib/almanack/representation/built_ical_event.rb, line 10 def ical_event @ical_event ||= build! end
Private Instance Methods
build!()
click to toggle source
# File lib/almanack/representation/built_ical_event.rb, line 20 def build! @ical_event = Icalendar::Event.new set_summary set_start_time set_end_time set_description set_location ical_event end
default_event_duration()
click to toggle source
# File lib/almanack/representation/built_ical_event.rb, line 58 def default_event_duration # Three hours is the duration for events missing end dates, a # recommendation suggested by Meetup.com. 3 * ONE_HOUR end
set_description()
click to toggle source
# File lib/almanack/representation/built_ical_event.rb, line 50 def set_description ical_event.description = event.description if event.description end
set_end_time()
click to toggle source
# File lib/almanack/representation/built_ical_event.rb, line 42 def set_end_time if event.end_time.is_a?(Icalendar::Values::Date) ical_event.dtend = event.end_time else ical_event.dtend = (event.end_time || event.start_time + default_event_duration ).utc end end
set_location()
click to toggle source
# File lib/almanack/representation/built_ical_event.rb, line 54 def set_location ical_event.location = event.location if event.location end
set_start_time()
click to toggle source
# File lib/almanack/representation/built_ical_event.rb, line 34 def set_start_time if event.start_time.is_a?(Icalendar::Values::Date) ical_event.dtstart = event.start_time else ical_event.dtstart = event.start_time.utc end end
set_summary()
click to toggle source
# File lib/almanack/representation/built_ical_event.rb, line 30 def set_summary ical_event.summary = event.title end