zeus.ugent.be/lib/helpers/ical.rb
2016-08-23 20:21:02 +02:00

19 lines
346 B
Ruby

module IcalHelper
def event_calendar
cal = Icalendar::Calendar.new
items.find_all('/events/*/*.md').each do |i|
cal.add_event(event_for(i))
end
cal.to_ical
end
def event_for(item)
event = Icalendar::Event.new
event.dtstart = Date.parse(item[:time])
event.summary = 'A great event!'
event
end
end