Module: YuiRestClient::Timer
- Defined in:
- lib/yui_rest_client/timer.rb
Class Method Summary collapse
-
.wait(timeout, interval) ⇒ Object
Execute code block with the interval until timeout reached.
Class Method Details
.wait(timeout, interval) ⇒ Object
Execute code block with the interval until timeout reached.
10 11 12 13 14 15 16 17 18 |
# File 'lib/yui_rest_client/timer.rb', line 10 def wait(timeout, interval) return yield if timeout.zero? end_time = Time.now.to_f + timeout while Time.now.to_f <= end_time yield sleep interval end end |