class MoreHoliday::Exporters::ICal

Attributes

content[R]
serialized[R]

Public Class Methods

new(content) click to toggle source
# File lib/more_holiday/exporters/i_cal.rb, line 8
def initialize content
  @content = content
end

Public Instance Methods

serialize() click to toggle source
# File lib/more_holiday/exporters/i_cal.rb, line 12
def serialize
  @cal = Icalendar::Calendar.new
  serialize_events
  @serialized = @cal.to_ical
end

Private Instance Methods

serialize_events() click to toggle source
# File lib/more_holiday/exporters/i_cal.rb, line 20
def serialize_events
  @content.each do |date, summary|
    @cal.event do |e|
      e.dtstart     = Icalendar::Values::Date.new(date.delete("-"))
      e.dtend       = Icalendar::Values::Date.new(date.delete("-"))
      e.summary     = summary
      e.ip_class    = "MoreHoliday"
    end
  end
end