FinalCAD / retryable_block

Method to retry block if it returns errors.
MIT License
0 stars 1 forks source link

RetryableBlock

Gem Version

Code Climate

Dependency Status

Build Status (Travis CI)

Coverage Status

A module that adds #retryable to your classes, which retries blocks when an exception occurs.

Installation

Add this line to your application's Gemfile:

gem 'retryable_block'

And then execute:

$ bundle

Or install it yourself as:

$ gem install retryable_block

Usage

Include RetryableBlock to your class and use retryable(n=3, sleep_time=nil, exceptions = [StandardError], &block)

n=3 means 3 retries sleep_time number of seconds for sleep between retries, if nil retry will be call immediately. exceptions list of exceptions for retries, you can pass list of exceptions classes, as default value it will use rescue StandardError

Contributing

  1. Fork it ( https://github.com/[my-github-username]/retryable_block/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request