Class: Markdo::IcsExporter
- Inherits:
-
Object
- Object
- Markdo::IcsExporter
- Defined in:
- lib/markdo/ics_exporter.rb
Defined Under Namespace
Classes: Event
Instance Method Summary collapse
-
#initialize(task_collection) ⇒ IcsExporter
constructor
A new instance of IcsExporter.
- #to_ics ⇒ Object
Constructor Details
#initialize(task_collection) ⇒ IcsExporter
Returns a new instance of IcsExporter.
5 6 7 |
# File 'lib/markdo/ics_exporter.rb', line 5 def initialize(task_collection) @task_collection = task_collection end |
Instance Method Details
#to_ics ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/markdo/ics_exporter.rb', line 9 def to_ics buf = [] buf << 'BEGIN:VCALENDAR' buf << 'VERSION:2.0' buf << 'CALSCALE:GREGORIAN' buf << 'METHOD:PUBLISH' buf << 'X-WR-CALNAME:Markdo Due Dates' buf << events.map { |event| event.to_ics } buf << 'END:VCALENDAR' buf. flatten. map { |line| "#{line}\n" }. join end |