Sha256: d9998e667d36583990ea7a77456236e4d2464367115357c7d0ae6da8e7844ce4

Contents?: true

Size: 421 Bytes

Versions: 4

Compression:

Stored size: 421 Bytes

Contents

module Timetrap
  module Formatters
    class Csv
      attr_reader :output

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

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

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
samg-timetrap-1.1.0 lib/timetrap/formatters/csv.rb
samg-timetrap-1.1.1 lib/timetrap/formatters/csv.rb
timetrap-1.1.2 lib/timetrap/formatters/csv.rb
timetrap-1.1.1 lib/timetrap/formatters/csv.rb