Sha256: c28c58f7eae334bb35421738cd044db2d4b4ded8c2a785a904fc68abd1bf56d8
Contents?: true
Size: 253 Bytes
Versions: 1
Compression:
Stored size: 253 Bytes
Contents
class Retry < MethodDecorator def initialize(max) @max = max end def call(orig, *args, &blk) attempts = 0 begin attempts += 1 orig.call(*args, &blk) rescue retry if attempts < @max raise end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
method_decorators-0.9.1 | lib/method_decorators/decorators/retry.rb |