Class: SpentTime
- Inherits:
-
Object
- Object
- SpentTime
- Defined in:
- lib/git-commit-mailer.rb
Instance Method Summary collapse
-
#initialize(label) ⇒ SpentTime
constructor
A new instance of SpentTime.
- #report ⇒ Object
- #spend ⇒ Object
Constructor Details
#initialize(label) ⇒ SpentTime
Returns a new instance of SpentTime.
39 40 41 42 |
# File 'lib/git-commit-mailer.rb', line 39 def initialize(label) @label = label @seconds = 0.0 end |
Instance Method Details
#report ⇒ Object
51 52 53 |
# File 'lib/git-commit-mailer.rb', line 51 def report puts "#{"%0.9s" % @seconds} seconds spent by #{@label}." end |
#spend ⇒ Object
44 45 46 47 48 49 |
# File 'lib/git-commit-mailer.rb', line 44 def spend start_time = Time.now returned_object = yield @seconds += (Time.now - start_time) returned_object end |