Class: Frontman::Toolbox::Timer
- Inherits:
-
Object
- Object
- Frontman::Toolbox::Timer
- Extended by:
- T::Sig
- Defined in:
- lib/frontman/toolbox/timer.rb
Class Method Summary collapse
Instance Method Summary collapse
- #begin ⇒ Object
- #diff ⇒ Object
- #ended_at ⇒ Object
- #output ⇒ Object
- #started_at ⇒ Object
- #stop ⇒ Object
Class Method Details
.start ⇒ Object
12 13 14 15 16 |
# File 'lib/frontman/toolbox/timer.rb', line 12 def self.start timer = new timer.begin timer end |
Instance Method Details
#begin ⇒ Object
19 20 21 |
# File 'lib/frontman/toolbox/timer.rb', line 19 def begin @start = Time.now end |
#diff ⇒ Object
29 30 31 |
# File 'lib/frontman/toolbox/timer.rb', line 29 def diff @end - @start end |
#ended_at ⇒ Object
39 40 41 |
# File 'lib/frontman/toolbox/timer.rb', line 39 def ended_at @end end |
#output ⇒ Object
44 45 46 |
# File 'lib/frontman/toolbox/timer.rb', line 44 def output "Elapsed time: ~#{(diff * 1000).ceil} milliseconds.\n" end |
#started_at ⇒ Object
34 35 36 |
# File 'lib/frontman/toolbox/timer.rb', line 34 def started_at @start end |
#stop ⇒ Object
24 25 26 |
# File 'lib/frontman/toolbox/timer.rb', line 24 def stop @end = Time.now end |