class Timetrap::Formatters::Ical

Public Class Methods

new(entries) click to toggle source
# 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

Public Instance Methods

<=>(other) click to toggle source
# File lib/timetrap/formatters/ical.rb, line 31
def <=> other
  dtstart > other.dtstart ? 1 : 0
end
calendar() click to toggle source
# File lib/timetrap/formatters/ical.rb, line 16
def calendar
  @calendar ||= Calendar.new
end
output() click to toggle source
# File lib/timetrap/formatters/ical.rb, line 20
def output
  calendar.to_ical
end