Module: EasyHook::HookTimer
- Included in:
- ClassMethods
- Defined in:
- lib/easy-hook.rb
Defined Under Namespace
Classes: Timer
Class Method Summary collapse
Class Method Details
.restart(id) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/easy-hook.rb', line 36 def self.restart(id) timer = ObjectSpace._id2ref(id) return false unless timer timer.start = Time.now timer.time = nil true end |
.stop(id) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/easy-hook.rb', line 44 def self.stop(id) stop = Time.now timer = ObjectSpace._id2ref(id) return false unless timer timer.time ||= stop - timer.start end |
.time(id) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/easy-hook.rb', line 51 def self.time(id) stop = Time.now timer = ObjectSpace._id2ref(id) return false unless timer stop - timer.start end |