Class: Time

encoding: utf-8

Public Visibility

Public Class Method Summary

timer(&block)

How long it takes to run the block in seconds.

Returns: Float

Public Instance Methods Inherited from Object

define_instance_method, not_nil?, try

Public Class Method Details

timer

public Float timer(&block)

How long it takes to run the block in seconds

Meta Tags

Parameters:

Returns:

[Float]

How long it takes to run the block in seconds

Author:

Botanicus

Since:

0.0.3

[View source]


11
12
13
14
# File 'lib/rango/ext/time.rb', line 11

def self.timer(&block)
  start = Time.now.tap { block.call }
  return Time.now - start
end