RAA - attempt

attempt / 0.1.1

Short description: A thin wrapper for begin + rescue + sleep + retry
Category: Library/Misc
Status: stable
Created: 2006-06-09 23:31:15 GMT
Last update: 2007-07-31 22:31:51 GMT
Owner: Daniel J. Berger (Projects of this owner)
Homepage: http://rubyforge.org/projects/shards/
Download: http://rubyforge.org/frs/download.php/23447/attempt-0.1.1.tar.gz
License: Ruby's
Dependency:
None
Description:

Description

   A thin wrapper for begin + rescue + sleep + retry.

Synopsis

   require 'attempt'

   # Attempt to ftp to some host, trying 3 times with 30 seconds between
   # attempts before finally raising an error.
   #
   attempt(3, 30){
      Net::FTP.open(host, user, passwd){ ... }
   }

   # Or, do things the long way...
   code = Attempt.new{ |a|
      a.tries    = 3
      a.interval = 30
   }

   code.attempt{
      Net::FTP.open(host, user, passwd){ ... }
   }
Versions: [0.1.1 (2007-07-31)] [0.1.0 (2006-06-09)]

Edit this project (for project owner)

back to RAA top