Module: Kernel
- Defined in:
- lib/fat_core/kernel.rb
Instance Method Summary collapse
-
#time_it(name = 'block', &block) ⇒ Object
Run the given block and report the time it took to execute in hour-minute-second form.
Instance Method Details
#time_it(name = 'block', &block) ⇒ Object
Run the given block and report the time it took to execute in hour-minute-second form.
17 18 19 20 21 22 23 |
# File 'lib/fat_core/kernel.rb', line 17 def time_it(name = 'block', &block) start = Time.now result = yield block run_time = Time.now - start puts "Ran #{name} in #{run_time.secs_to_hms}" result end |