Sha256: e39495499a29a32f8c01b6d14bc4310b98237997555071984e5605bd73fa3012

Contents?: true

Size: 572 Bytes

Versions: 8

Compression:

Stored size: 572 Bytes

Contents

require 'icalendar'
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
            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

8 entries across 8 versions & 2 rubygems

Version Path
samg-timetrap-1.0.3 lib/timetrap/formatters/ical.rb
samg-timetrap-1.1.0 lib/timetrap/formatters/ical.rb
samg-timetrap-1.1.1 lib/timetrap/formatters/ical.rb
timetrap-1.2.1 lib/timetrap/formatters/ical.rb
timetrap-1.2.0 lib/timetrap/formatters/ical.rb
timetrap-1.1.3 lib/timetrap/formatters/ical.rb
timetrap-1.1.2 lib/timetrap/formatters/ical.rb
timetrap-1.1.1 lib/timetrap/formatters/ical.rb