Class: Twstats::TwLog
- Inherits:
-
Object
- Object
- Twstats::TwLog
- Defined in:
- lib/twstats/tw_log.rb
Instance Attribute Summary collapse
-
#billable ⇒ Object
readonly
Returns the value of attribute billable.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#decimal_time ⇒ Object
readonly
Returns the value of attribute decimal_time.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#invoiced ⇒ Object
readonly
Returns the value of attribute invoiced.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#start_date ⇒ Object
readonly
Returns the value of attribute start_date.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#task ⇒ Object
readonly
Returns the value of attribute task.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#who ⇒ Object
readonly
Returns the value of attribute who.
Instance Method Summary collapse
-
#initialize(row) ⇒ TwLog
constructor
Class use to store the information needed form a given log.
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"] = 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
#billable ⇒ Object (readonly)
Returns the value of attribute billable.
12 13 14 |
# File 'lib/twstats/tw_log.rb', line 12 def billable @billable end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
8 9 10 |
# File 'lib/twstats/tw_log.rb', line 8 def date @date end |
#decimal_time ⇒ Object (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 |
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/twstats/tw_log.rb', line 7 def description @description end |
#invoiced ⇒ Object (readonly)
Returns the value of attribute invoiced.
13 14 15 |
# File 'lib/twstats/tw_log.rb', line 13 def invoiced @invoiced end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
10 11 12 |
# File 'lib/twstats/tw_log.rb', line 10 def project @project end |
#start_date ⇒ Object (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 |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
9 10 11 |
# File 'lib/twstats/tw_log.rb', line 9 def end |
#task ⇒ Object (readonly)
Returns the value of attribute task.
11 12 13 |
# File 'lib/twstats/tw_log.rb', line 11 def task @task end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
5 6 7 |
# File 'lib/twstats/tw_log.rb', line 5 def time @time end |
#who ⇒ Object (readonly)
Returns the value of attribute who.
4 5 6 |
# File 'lib/twstats/tw_log.rb', line 4 def who @who end |