Module: Collective::Idler::Utilities
- Included in:
- Collective::Idler
- Defined in:
- lib/collective/idler.rb
Instance Method Summary collapse
-
#wait_until(timeout = 1, &test) ⇒ Object
execute test repeatedly, until timeout, or until test returns true.
Instance Method Details
#wait_until(timeout = 1, &test) ⇒ Object
execute test repeatedly, until timeout, or until test returns true
70 71 72 73 74 75 76 77 |
# File 'lib/collective/idler.rb', line 70 def wait_until( timeout = 1, &test ) tester = Collective::Idler.new(test) finish = Time.now.to_f + timeout loop do break if tester.call break if finish < Time.now.to_f end end |