No commit activity in last 3 years
No release in over 3 years
Allow to retry unsafe methods.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.8.9
~> 10.0
>= 0
 Project Readme

RetryUnsafeMethod

Allow easily make methods retriable

Version  Travis CI CodeClimate Coverage

Installation

Add this line to your application's Gemfile:

gem 'retry_unsafe_method'

And then execute:

$ bundle

Or install it yourself as:

$ gem install retry_unsafe_method

Usage

include module to your class ``

and add after method definition

retry_unsafe_method <method_name>, <retries_qty>, *<exceptions>

or

retry_unsafe_method <method_name>, <retries_qty>, *<exceptions>, <options>

or

retry_unsafe_method <method_name>, <retries_qty>, &<block>

or

retry_unsafe_method <method_name>, <retries_qty>, <options>, &<block>

require 'retry_unsafe_method'

class SomeError < StandardError
end

class A
  include RetryUnsafeMethod::RetryUnsafeMethod
  
  def some_method
    # can raise SomeError
  end
  
  retry_unsafe_method :some_method, 2, SomeError
  # or
  retry_unsafe_method :some_method, 2, SomeError, wait: 5
  # or
  retry_unsafe_method :some_method, 2 do |e|
    e.is_a?(SomeError)
  end
  # or
  retry_unsafe_method :some_method, 2, wait: 5 do |e|
      e.is_a?(SomeError)
  end
  
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/senid231/retry_unsafe_method.

License

The gem is available as open source under the terms of the MIT License.