Module: Retriable
- Extended by:
- Retriable
- Defined in:
- lib/retriable.rb,
lib/retriable/retry.rb,
lib/retriable/version.rb
Defined Under Namespace
Classes: Retry
Constant Summary collapse
- VERSION =
'1.4.1'
Instance Method Summary collapse
Instance Method Details
#retriable(opts = {}, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/retriable.rb', line 6 def retriable(opts = {}, &block) raise LocalJumpError unless block_given? Retry.new do |r| r.tries = opts[:tries] if opts[:tries] r.on = opts[:on] if opts[:on] r.interval = opts[:interval] if opts[:interval] r.timeout = opts[:timeout] if opts[:timeout] r.on_retry = opts[:on_retry] if opts[:on_retry] end.perform(&block) end |