Permalink
Browse files

Add some examples to the README.

  • Loading branch information...
1 parent 166c959 commit 2dba66e3b53b537a9f4823a08c7f0a5f61671271 @chuyeow committed Sep 17, 2008
Showing with 17 additions and 1 deletion.
  1. +17 −1 README
View
18 README
@@ -1,3 +1,19 @@
= try
-Extensions to Kernel that allow for retryable blocks of code.
+Extensions to Kernel that allow for retryable blocks of code.
+
+== Examples
+
+* Kernel#retryable
+
+ retryable(:tries => 3, :on => StandardError) do
+ # Some code that could fail, like connecting to a flakey API.
+ end
+
+* Kernel#try
+
+ try(
+ some_method_that_could_fail,
+ Proc.new { raise RuntimeError unless moon.is_blue? },
+ 'some fallback value if all things fail'
+ )

0 comments on commit 2dba66e

Please sign in to comment.