Sha256: 25c1ac8b3eb752e475f7d99f88d28f836cabeb5bc00b138a8de2123240f98c44

Contents?: true

Size: 804 Bytes

Versions: 1

Compression:

Stored size: 804 Bytes

Contents

require 'time'
module Twstats
  class TwLog
    attr_reader :who
    attr_reader :time
    attr_reader :decimal_time
    attr_reader :description
    attr_reader :date
    attr_reader :tags
    attr_reader :project
    attr_reader :task
    attr_reader :billable


    # Class use to store the information needed form a given log
    def initialize(row)
      # Receives a row of the CSV file
      @who = row["Who"]
      @decimal_time = row["Decimal Hours"].to_f
      @time = (DateTime.parse(row["End Date/Time"]) - DateTime.parse(row["Date/Time"]))*24
      @description = row["Description"]
      @tags = row["Tags"].split(',')
      @project = row["Project"]
      @task = row["Task"]
      @billable = !row["Is it Billable?"].to_i.zero?
      @date = DateTime.parse(row['Date'])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twstats-0.2.2 lib/twstats/tw_log.rb