Sha256: 0eb4034aa2e83fcff41b133ce8f1fccc93cfa41e0bb59ba4e3523409812ceba5

Contents?: true

Size: 314 Bytes

Versions: 2

Compression:

Stored size: 314 Bytes

Contents

module Landrush
  module Util
    module Retry
      def retry(opts=nil)
        opts = {tries: 1}.merge(opts || {})
        n = 0
        while n < opts[:tries]
          return true if yield
          sleep opts[:sleep].to_f if opts[:sleep]
          n += 1
        end
        false
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
landrush-1.1.0.beta.2 lib/landrush/util/retry.rb
landrush-1.1.0.beta.1 lib/landrush/util/retry.rb