Module: YuiRestClient::Wait
- Defined in:
- lib/yui_rest_client/wait.rb
Class Method Summary collapse
- .until(timeout:, interval:, message: nil, object: nil) ⇒ Object
- .while(timeout:, interval:, message: nil, object: nil) ⇒ Object
Class Method Details
.until(timeout:, interval:, message: nil, object: nil) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/yui_rest_client/wait.rb', line 5 def self.until(timeout:, interval:, message: nil, object: nil) Timer.wait(timeout, interval) do result = yield(object) return result if result end raise Error::TimeoutError, "timed out after #{timeout} seconds. #{}" end |
.while(timeout:, interval:, message: nil, object: nil) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/yui_rest_client/wait.rb', line 13 def self.while(timeout:, interval:, message: nil, object: nil) Timer.wait(timeout, interval) do result = yield(object) return unless result end raise Error::TimeoutError, "timed out after #{timeout} seconds. #{}" end |