Class: Twstats::TwLog

Inherits:
Object
  • Object
show all
Defined in:
lib/twstats/tw_log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row) ⇒ TwLog

Class use to store the information needed form a given log



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/twstats/tw_log.rb', line 17

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

Instance Attribute Details

#billableObject (readonly)

Returns the value of attribute billable.



12
13
14
# File 'lib/twstats/tw_log.rb', line 12

def billable
  @billable
end

#dateObject (readonly)

Returns the value of attribute date.



8
9
10
# File 'lib/twstats/tw_log.rb', line 8

def date
  @date
end

#decimal_timeObject (readonly)

Returns the value of attribute decimal_time.



6
7
8
# File 'lib/twstats/tw_log.rb', line 6

def decimal_time
  @decimal_time
end

#descriptionObject (readonly)

Returns the value of attribute description.



7
8
9
# File 'lib/twstats/tw_log.rb', line 7

def description
  @description
end

#invoicedObject (readonly)

Returns the value of attribute invoiced.



13
14
15
# File 'lib/twstats/tw_log.rb', line 13

def invoiced
  @invoiced
end

#projectObject (readonly)

Returns the value of attribute project.



10
11
12
# File 'lib/twstats/tw_log.rb', line 10

def project
  @project
end

#start_dateObject (readonly)

Returns the value of attribute start_date.



14
15
16
# File 'lib/twstats/tw_log.rb', line 14

def start_date
  @start_date
end

#tagsObject (readonly)

Returns the value of attribute tags.



9
10
11
# File 'lib/twstats/tw_log.rb', line 9

def tags
  @tags
end

#taskObject (readonly)

Returns the value of attribute task.



11
12
13
# File 'lib/twstats/tw_log.rb', line 11

def task
  @task
end

#timeObject (readonly)

Returns the value of attribute time.



5
6
7
# File 'lib/twstats/tw_log.rb', line 5

def time
  @time
end

#whoObject (readonly)

Returns the value of attribute who.



4
5
6
# File 'lib/twstats/tw_log.rb', line 4

def who
  @who
end