Sha256: 08e844ec8f62b437d0bcfa44eb6e8eb79870052a32752bed213dce010906ea62

Contents?: true

Size: 322 Bytes

Versions: 7

Compression:

Stored size: 322 Bytes

Contents

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cistern-0.2.3 lib/cistern/wait_for.rb
cistern-0.2.2 lib/cistern/wait_for.rb
cistern-0.2.1 lib/cistern/wait_for.rb
cistern-0.2.0 lib/cistern/wait_for.rb
cistern-0.1.4 lib/cistern/wait_for.rb
cistern-0.1.2 lib/cistern/wait_for.rb
cistern-0.0.3 lib/cistern/wait_for.rb