Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chuyeow/try

Extensions to Ruby's Kernel that allow for retryable blocks of code.
https://github.com/chuyeow/try

Last synced: about 2 months ago
JSON representation

Extensions to Ruby's Kernel that allow for retryable blocks of code.

Awesome Lists containing this project

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