Sha256: effa76e65bb8e8f61cce9cd77da3dd0c3087fc23fc2b5a4e5148adcc13799ba4

Contents?: true

Size: 453 Bytes

Versions: 40

Compression:

Stored size: 453 Bytes

Contents

module Cistern
  module WaitFor
    def self.wait_for(timeout = Cistern.timeout, interval = Cistern.poll_interval, &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

    def self.wait_for!(*arg)
      wait_for
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
cistern-0.12.3 lib/cistern/timeout.rb
cistern-2.2.3 lib/cistern/timeout.rb
cistern-2.2.1 lib/cistern/timeout.rb
cistern-2.1.0 lib/cistern/timeout.rb
cistern-2.0.5 lib/cistern/timeout.rb
cistern-2.0.4 lib/cistern/timeout.rb
cistern-0.12.2 lib/cistern/timeout.rb
cistern-0.12.1 lib/cistern/timeout.rb
cistern-2.0.3 lib/cistern/timeout.rb
cistern-2.0.2 lib/cistern/timeout.rb
cistern-0.11.3 lib/cistern/timeout.rb
cistern-2.0.1 lib/cistern/timeout.rb
cistern-1.0.1.pre6 lib/cistern/timeout.rb
cistern-1.0.1.pre5 lib/cistern/timeout.rb
cistern-1.0.1.pre4 lib/cistern/timeout.rb
cistern-1.0.1.pre3 lib/cistern/timeout.rb
cistern-1.0.1.pre2 lib/cistern/timeout.rb
cistern-0.11.2 lib/cistern/timeout.rb
cistern-1.0.1.pre1 lib/cistern/timeout.rb
cistern-1.0.0.pre lib/cistern/timeout.rb