class Session

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/kale/session.rb, line 5
def initialize
  @stopwatch = Stopwatch.new
  @stopwatch.start
  
  super
end

Public Instance Methods

earned() click to toggle source
# File lib/kale/session.rb, line 23
def earned
  "$" + sprintf("%.2f", self.project.rate_per_hour.to_f * (self.elapsed_time.to_f / 3600))
end
stop(opts) click to toggle source
# File lib/kale/session.rb, line 12
def stop opts
  @stopwatch.stop

  self.start_time   = @stopwatch.start_time
  self.end_time     = @stopwatch.end_time
  self.elapsed_time = @stopwatch.elapsed_time
  self.description  = opts[:description]
  self.project      = opts[:project]
  self.save
end