Class: Markdo::IcsExporter::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/markdo/ics_exporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(date_start, date_end, summary) ⇒ Event

Returns a new instance of Event.



48
49
50
51
52
# File 'lib/markdo/ics_exporter.rb', line 48

def initialize(date_start, date_end, summary)
  @date_start = date_start
  @date_end = date_end
  @summary = summary
end

Instance Method Details

#to_icsObject



54
55
56
57
58
59
60
61
62
# File 'lib/markdo/ics_exporter.rb', line 54

def to_ics
  buf = []
  buf << 'BEGIN:VEVENT'
  buf << "DTSTART;VALUE=DATE:#{@date_start.strftime('%Y%m%d')}"
  buf << "DTEND;VALUE=DATE:#{@date_end.strftime('%Y%m%d')}"
  buf << "SUMMARY:#{@summary}"
  buf << 'END:VEVENT'
  buf.join("\n")
end