module YuiRestClient::Timer
Public Instance Methods
wait(timeout, interval) { || ... }
click to toggle source
Execute code block with the interval until timeout reached. @param timeout [Numeric] how many time in seconds to wait @param interval [Numeric] time in seconds between attempts
# 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