| 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: |
2009-08-01 11:34:05 GMT |
| Owner: |
Daniel J. Berger
(Projects of this owner) |
| Homepage: |
http://rubyforge.org/projects/shards/ |
| Download: |
http://rubyforge.org/frs/download.php/61373/attempt-0.1.2.tar.gz
|
| License: |
Ruby's |
| Dependency: |
|
| 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.2 (2009-08-01)]
[0.1.1 (2007-07-31)]
[0.1.0 (2006-06-09)]
|