Tryout Build Status

Allows you to do dirty stuff without messing up your code base.


I've found myself using begin/rescue/retry through HTTP requests frequently, due timeout, weird stuff caused by a messed up third-party service, or even due internet connectivity lost.

How to use

Currently, Tryout supports 3 alternatives of conditional logic.

if/unless: call any method on the result of the try block.

value = Tryout.try { RestClient.get('') }.retry(3, :if => :empty?)
value = Tryout.try { RestClient.get('') }.retry(3, :unless => :present?)

block: the result of the try block will be passed as argument for the second one. Is up to you when the result is considered invalid.

value = Tryout.try { RestClient.get('') }.retry(3) do |invalid|
  # Invalidate when response have length lesser than 100
  invalid.length < 100


Tryout is released under the MIT license. Please read the LICENSE file.