Class Timer
In: lib/facet/timer.rb
Parent: Object

Desception

Timer class. Also provides a block method for running a timed procedure.

Usage

  require 'facet/timer'

  timed { |timer|

     timer.total_time.round #=> 0

     sleep 1
     timer.total_time.round #=> 1

     timer.stop
     timer.total_time.round #=> 1

     sleep 2
     timer.total_time.round #=> 1

     timer.start
     timer.total_time.round #=> 1

     sleep 1
     timer.total_time.round #=> 2

  }

Notes

I would like to take this and meger it with TimeLimit in some manner.

Legal

Adapted from Ruby Treasures 0.4 Copyright (C) 2002 Paul Brannan <paul@atdesk.com>

You may distribute this software under the same terms as Ruby (see the file COPYING that was distributed with this library).

Methods

new   running?   start   stop   stopped?   total_time  

Constants

VERSION = '0.1.0'

Attributes

end_time  [R] 
start_time  [R] 

Public Class methods

Public Instance methods

[Validate]