class Project
Attributes
expected[RW]
name[RW]
start_time[RW]
state[RW]
time[RW]
Public Class Methods
headings()
click to toggle source
# File lib/trakr/project.rb, line 31 def self.headings ['Running', 'Name', 'Time', 'Estimate'] end
new(name, expected=nil)
click to toggle source
# File lib/trakr/project.rb, line 5 def initialize(name, expected=nil) @name = name @expected = expected @state = false @time = 0 end
Public Instance Methods
start_timer()
click to toggle source
# File lib/trakr/project.rb, line 12 def start_timer @state = true @start_time = Time.now end
stop_timer()
click to toggle source
# File lib/trakr/project.rb, line 17 def stop_timer @state = false @time += Time.now - start_time @start_time = nil end
to_a()
click to toggle source
# File lib/trakr/project.rb, line 23 def to_a if @state [@state.to_s.foreground(:green), @name, (Time.now - @start_time).duration, @expected] else [@state.to_s.foreground(:red), @name, @time.duration, @expected] end end