Sha256: 2c9257dfe1fdec4bf84dc7b2f014455d004fdc9f472d1c74aa045d8856e3dab5
Contents?: true
Size: 884 Bytes
Versions: 4
Compression:
Stored size: 884 Bytes
Contents
module Watir module Wait class Timer def initialize(timeout: nil) @end_time = current_time + timeout if timeout end # # Executes given block until it returns true or exceeds timeout. # @param [Integer] timeout # @yield block # @api private # def wait(timeout, &block) end_time = @end_time || current_time + timeout loop do yield(block) break if current_time > end_time end end def reset! @end_time = nil end def locked? !@end_time.nil? end private if defined?(Process::CLOCK_MONOTONIC) def current_time Process.clock_gettime(Process::CLOCK_MONOTONIC) end else def current_time ::Time.now.to_f end end end # Timer end # Wait end # Watir
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
watir-6.3.0 | lib/watir/wait/timer.rb |
watir-6.2.1 | lib/watir/wait/timer.rb |
watir-6.2.0 | lib/watir/wait/timer.rb |
watir-6.1.0 | lib/watir/wait/timer.rb |