Sha256: 923d722af37449ef5da6861d93ed94c1f788311dfbb65c6fdf92f999d337bbd5

Contents?: true

Size: 532 Bytes

Versions: 29

Compression:

Stored size: 532 Bytes

Contents

module RAutomation
  # Waiting with timeout
  module WaitHelper
    extend self
    
    class TimeoutError < StandardError
    end

    # @private
    # Wait until the block evaluates to true or times out.
    def wait_until(timeout = Window.wait_timeout, &block)
      end_time = ::Time.now + timeout

      until ::Time.now > end_time
        result = yield(self)
        return result if result
        sleep 0.5
      end

      raise TimeoutError, "timed out after #{timeout} seconds"
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
rautomation-2.0.1-x86-mingw32 lib/rautomation/wait_helper.rb
rautomation-2.0.1-x64-mingw32 lib/rautomation/wait_helper.rb
rautomation-1.1.0 lib/rautomation/wait_helper.rb
rautomation-1.0.0 lib/rautomation/wait_helper.rb
rautomation-0.17.0 lib/rautomation/wait_helper.rb
rautomation-0.16.0 lib/rautomation/wait_helper.rb
rautomation-0.15.0 lib/rautomation/wait_helper.rb
rautomation-0.14.1 lib/rautomation/wait_helper.rb
rautomation-0.14.0 lib/rautomation/wait_helper.rb
rautomation-0.13.0 lib/rautomation/wait_helper.rb
rautomation-0.12.0 lib/rautomation/wait_helper.rb
rautomation-0.11.0 lib/rautomation/wait_helper.rb
rautomation-0.10.0 lib/rautomation/wait_helper.rb
rautomation-0.9.4 lib/rautomation/wait_helper.rb
rautomation-0.9.3 lib/rautomation/wait_helper.rb
rautomation-0.9.2 lib/rautomation/wait_helper.rb
rautomation-0.9.1 lib/rautomation/wait_helper.rb
rautomation-0.9.0 lib/rautomation/wait_helper.rb
rautomation-0.8.0 lib/rautomation/wait_helper.rb
rautomation-0.7.3 lib/rautomation/wait_helper.rb