1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/core/wait_for.rb
2010-12-16 11:24:52 -08:00

17 lines
No EOL
304 B
Ruby

module Fog
def self.wait_for(timeout=600, interval=1, &block)
duration = 0
start = Time.now
until yield || duration > timeout
sleep(interval)
duration = Time.now - start
end
if duration > timeout
false
else
{ :duration => duration }
end
end
end