Sha256: 387b0c5adf76cc7af3712ba3b1b505e504fce9e204b38b4fe9e1c7f1419ae74f
Contents?: true
Size: 992 Bytes
Versions: 3
Compression:
Stored size: 992 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 attr_reader :invoiced attr_reader :start_date # 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'].nil? ? [] : row["Tags"].split(',').map{|x| x.strip} @project = row["Project"] @task = row["Task"] @billable = !row["Is it Billable?"].to_i.zero? @invoiced = !row['Invoice Number'] @date = DateTime.parse(row['Date']) @start_date = DateTime.parse(row["Date/Time"]) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
twstats-0.3.1 | lib/twstats/tw_log.rb |
twstats-0.3.0 | lib/twstats/tw_log.rb |
twstats-0.2.5 | lib/twstats/tw_log.rb |