From e11976f9a29a6f7c5937f4b51bddfb5d830c0913 Mon Sep 17 00:00:00 2001 From: Denis Knauf Date: Wed, 17 Mar 2010 13:26:24 +0100 Subject: [PATCH] More docs --- lib/robustserver.rb | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/lib/robustserver.rb b/lib/robustserver.rb index ce1e968..b456d25 100644 --- a/lib/robustserver.rb +++ b/lib/robustserver.rb @@ -31,24 +31,31 @@ def Signal.[] s end end +# Description +# =========== +# # Counts retries ot something. If the retries are to often in a short time, # you shouldn't retry again. # -# Example: -# retries = Retry.new 5, 1 -# begin -# array_of_ints_and_some_strings.each do |i| -# puts 2*i -# end -# rescue TypeError -# retries.retry? and retry -# raise $! -# end +# Examples +# ======== +# +# Strings aren't Integers and 2*"Text" will raise TypeError. # -# Retry.new( 10, 30).run( ConnectionLost) do -# try_to_connect_to_db -# try_query -# end +# retries = Retry.new 5, 1 +# begin +# array_of_ints_and_some_strings.each do |i| +# puts 2*i +# end +# rescue TypeError +# retries.retry? and retry +# raise $! +# end +# +# Retry.new( 10, 30).run( ConnectionLost) do +# try_to_connect_to_db +# try_query +# end class Retries attr_accessor :max, :range attr_reader :count, :last