Extensions to Ruby's Kernel that allow for retryable blocks of code.
Ruby
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
lib Copying over files from previously unpublished code repository. Sep 17, 2008
spec
README Add some examples to the README. Sep 17, 2008

README

= try

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'
  )