Sha256: 927077c05a87ee426873de7ed2e5e631c20bc0cc6bcd7cf320848b829391dc0e
Contents?: true
Size: 600 Bytes
Versions: 1
Compression:
Stored size: 600 Bytes
Contents
module Beaker module Shared module Repetition def repeat_for seconds, &block timeout = Time.now + seconds done = false until done or timeout < Time.now do done = block.call end return done end def repeat_fibonacci_style_for attempts, &block done = false attempt = 1 last_wait, wait = 0, 1 while not done and attempt <= attempts do done = block.call sleep wait last_wait, wait = wait, last_wait + wait end return done end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
beaker-0.0.0 | lib/beaker/shared/repetition.rb |