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