Class: Timetrap::Formatters::Ical
- Inherits:
-
Object
- Object
- Timetrap::Formatters::Ical
- Includes:
- Icalendar
- Defined in:
- lib/timetrap/formatters/ical.rb
Instance Method Summary collapse
- #calendar ⇒ Object
-
#initialize(entries) ⇒ Ical
constructor
A new instance of Ical.
- #output ⇒ Object
Constructor Details
#initialize(entries) ⇒ Ical
Returns a new instance of Ical.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/timetrap/formatters/ical.rb', line 24 def initialize entries entries.each do |e| next unless e.end calendar.event do # hack around an issue in ical gem in ruby 1.9 unless respond_to? :<=> def <=> other dtstart > other.dtstart ? 1 : 0 end end dtstart DateTime.parse(e.start.to_s) dtend DateTime.parse(e.end.to_s) summary e.note description e.note end end calendar.publish end |
Instance Method Details
#calendar ⇒ Object
16 17 18 |
# File 'lib/timetrap/formatters/ical.rb', line 16 def calendar @calendar ||= Calendar.new end |
#output ⇒ Object
20 21 22 |
# File 'lib/timetrap/formatters/ical.rb', line 20 def output calendar.to_ical end |