Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add some examples to the README.

  • Loading branch information...
commit 2dba66e3b53b537a9f4823a08c7f0a5f61671271 1 parent 166c959
Cheah Chu Yeow authored

Showing 1 changed file with 17 additions and 1 deletion. Show diff stats Hide diff stats

  1. 18  README
18  README
... ...
@@ -1,3 +1,19 @@
1 1
 = try
2 2
 
3  
-Extensions to Kernel that allow for retryable blocks of code.
  3
+Extensions to Kernel that allow for retryable blocks of code.
  4
+
  5
+== Examples
  6
+
  7
+* Kernel#retryable
  8
+
  9
+  retryable(:tries => 3, :on => StandardError) do
  10
+    # Some code that could fail, like connecting to a flakey API.
  11
+  end
  12
+
  13
+* Kernel#try
  14
+
  15
+  try(
  16
+    some_method_that_could_fail,
  17
+    Proc.new { raise RuntimeError unless moon.is_blue? },
  18
+    'some fallback value if all things fail'
  19
+  )

0 notes on commit 2dba66e

Please sign in to comment.
Something went wrong with that request. Please try again.