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.
37 38 39 40 |
# File 'lib/git-commit-mailer.rb', line 37 def initialize(label) @label = label @seconds = 0.0 end |
Instance Method Details
#report ⇒ Object
49 50 51 |
# File 'lib/git-commit-mailer.rb', line 49 def report puts "#{"%0.9s" % @seconds} seconds spent by #{@label}." end |
#spend ⇒ Object
42 43 44 45 46 47 |
# File 'lib/git-commit-mailer.rb', line 42 def spend start_time = Time.now returned_object = yield @seconds += (Time.now - start_time) returned_object end |