Sha256: 49765e8b576ae8360ee7f4ebd8985bed51c48eedf1d6b0fdb5a80d370a40abd9

Contents?: true

Size: 330 Bytes

Versions: 2

Compression:

Stored size: 330 Bytes

Contents

module Magpie
  module Rubber

    def self.try(times = 1, options = { }, &block)
      val = yield times
    rescue options[:on] || Exception => e
      Magpie.logger.info("#{Time.now}:#{__FILE__}:#{__LINE__}}:#{e.backtrace[0..8].join("\n")}")
      retry if (times -= 1) > 0
      raise e
    else
      val
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
magpie-0.8.8.1 lib/magpie/rubber.rb
magpie-0.8.8 lib/magpie/rubber.rb