Class: Session
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- Session
- Defined in:
- lib/kale/session.rb
Instance Method Summary collapse
- #earned ⇒ Object
-
#initialize ⇒ Session
constructor
A new instance of Session.
- #stop(opts) ⇒ Object
Constructor Details
Instance Method Details
#earned ⇒ Object
23 24 25 |
# 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) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# 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 |