Sha256: 0fa0c7215afaab22b6e89c2dcd7f604e37e86a75e39a53418ad177bb1bab18c9

Contents?: true

Size: 418 Bytes

Versions: 19

Compression:

Stored size: 418 Bytes

Contents

module Fog
  def self.wait_for(timeout=Fog.timeout, interval=Fog.interval, &block)
    duration = 0
    start = Time.now
    until yield || duration > timeout
      sleep(interval.to_f)
      duration = Time.now - start
    end
    if duration > timeout
      raise Errors::TimeoutError.new("The specified wait_for timeout (#{timeout} seconds) was exceeded")
    else
      { :duration => duration }
    end
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
fog-core-1.21.1 lib/fog/core/wait_for.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/core/wait_for.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/core/wait_for.rb
fog-core-1.21.0 lib/fog/core/wait_for.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/core/wait_for.rb
fog-1.20.0 lib/fog/core/wait_for.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/core/wait_for.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/core/wait_for.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/core/wait_for.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/core/wait_for.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/core/wait_for.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/core/wait_for.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/core/wait_for.rb
fog-1.19.0 lib/fog/core/wait_for.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/core/wait_for.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/core/wait_for.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/core/wait_for.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/core/wait_for.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/core/wait_for.rb