Sha256: 272a4fda72c2a49aa24c543bff79bc307d89a94adb4f1ffa3770de174cdaf6e8

Contents?: true

Size: 440 Bytes

Versions: 52

Compression:

Stored size: 440 Bytes

Contents

module Timetrap
  module Formatters
    class Csv
      attr_reader :output

      def initialize entries
        @output = entries.inject("start,end,note,sheet\n") do |out, e|
          next(out) unless e.end
          out << %|"#{e.start.strftime(time_format)}","#{e.end.strftime(time_format)}","#{e.note}","#{e.sheet}"\n|
        end
      end

      private
      def time_format
        "%Y-%m-%d %H:%M:%S"
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
timetrap-1.6.1 lib/timetrap/formatters/csv.rb
timetrap-1.6.0 lib/timetrap/formatters/csv.rb
timetrap-1.5.3 lib/timetrap/formatters/csv.rb
timetrap-1.5.2 lib/timetrap/formatters/csv.rb
timetrap-1.5.1 lib/timetrap/formatters/csv.rb
timetrap-1.5.0 lib/timetrap/formatters/csv.rb
timetrap-1.4.1 lib/timetrap/formatters/csv.rb
timetrap-1.4.0 lib/timetrap/formatters/csv.rb
timetrap-1.3.0 lib/timetrap/formatters/csv.rb
timetrap-1.2.1 lib/timetrap/formatters/csv.rb
timetrap-1.2.0 lib/timetrap/formatters/csv.rb
timetrap-1.1.3 lib/timetrap/formatters/csv.rb