Sha256: 2b0c2d848dab6107c412071c0c33468f9f5dfa630c7f194eef810a70b65029a1
Contents?: true
Size: 941 Bytes
Versions: 40
Compression:
Stored size: 941 Bytes
Contents
begin require 'icalendar' rescue LoadError raise <<-ERR The icalendar gem must be installed for ical output. To install it: $ [sudo] gem install icalendar -v"~>1.1.5" ERR end require 'date' module Timetrap module Formatters class Ical include Icalendar def calendar @calendar ||= Calendar.new end def output calendar.to_ical end 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 end end end
Version data entries
40 entries across 40 versions & 1 rubygems