Module: Waiter
- Included in:
- AppiumServer, RUTL::Interface::Base, WindowsTestApp
- Defined in:
- lib/utilities/waiter.rb
Overview
The waiter waits.
Constant Summary collapse
- POLL_SLEEP_TIME =
0.01
- DEFAULT_TIMEOUT =
5
Instance Method Summary collapse
-
#await(lamb, timeout = DEFAULT_TIMEOUT, poll_sleep_time = POLL_SLEEP_TIME) ⇒ Object
The lambda passed to await should return false if thing not found and something truthy if found.
Instance Method Details
#await(lamb, timeout = DEFAULT_TIMEOUT, poll_sleep_time = POLL_SLEEP_TIME) ⇒ Object
The lambda passed to await should return false if thing not found and something truthy if found
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/utilities/waiter.rb', line 12 def await(lamb, timeout = DEFAULT_TIMEOUT, poll_sleep_time = POLL_SLEEP_TIME) Timeout.timeout(timeout) do loop do result = lamb.call return result if result # rubocop:disable Style/SleepCop sleep poll_sleep_time # rubocop:enable Style/SleepCop end end end |