Sha256: d7a60cfcdc1d6da840cbeef76c1ea3a00b63c2b77173920a158a74ee1bd31da7
Contents?: true
Size: 883 Bytes
Versions: 2
Compression:
Stored size: 883 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 [Fixnum] 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
watir-6.0.3 | lib/watir/wait/timer.rb |
watir-6.0.2 | lib/watir/wait/timer.rb |