Method: Fog.wait_for

Defined in:
lib/fog/core/wait_for.rb

.wait_for(timeout = 600, interval = 1, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/core/wait_for.rb', line 3

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