Module: Retriable
Instance Method Summary collapse
Instance Method Details
#retriable(opts = {}, &block) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/run_loop/patches/retriable.rb', line 33 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 |