How long it takes to run the block in seconds.
How long it takes to run the block in seconds
Examples:
Time.timer { sleep 2 } # => 2.030802
Returns:
Author:
Botanicus
Since:
0.0.3
11 12 13 14
# File 'lib/rubyexts/time.rb', line 11 def self.timer(&block) start = Time.now.tap { block.call } return Time.now - start end