class CLI::Kit::Util::Retrier
Public Class Methods
new(block_that_might_raise)
click to toggle source
# File lib/cli/kit/util.rb, line 167 def initialize(block_that_might_raise) @block_that_might_raise = block_that_might_raise end
Public Instance Methods
retry_after(exception = StandardError, retries: 1) { || ... }
click to toggle source
# File lib/cli/kit/util.rb, line 171 def retry_after(exception = StandardError, retries: 1, &before_retry) @block_that_might_raise.call rescue exception => e raise if (retries -= 1) < 0 if before_retry if before_retry.arity == 0 yield else yield e end end retry end