Sha256: cc3d313cc8c2999313cacf93cb0f4ed84d374ea2b647873a6b70b134a3e4f0ba

Contents?: true

Size: 344 Bytes

Versions: 4

Compression:

Stored size: 344 Bytes

Contents

module Kernel
  # adds a elapse time method
  # @yield the block to find the execution elapsed time of
  # @return [Float] the number of seconds the block took to execute
  def elapse(&block)
    seconds = 0
    unless block.nil?
      start_time = Time.now
      block.call
      seconds = Time.now - start_time
    end
    seconds
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
royw-drbman-0.0.3 examples/primes/lib/primes/kernel_extensions.rb
royw-drbman-0.0.4 examples/primes/lib/primes/kernel_extensions.rb
royw-drbman-0.0.5 examples/primes/lib/primes/kernel_extensions.rb
royw-drbman-0.0.6 examples/primes/lib/primes/kernel_extensions.rb