Module: Kernel
- Defined in:
- lib/sudo/support/kernel.rb
Instance Method Summary collapse
Instance Method Details
#wait_for(conf) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sudo/support/kernel.rb', line 2 def wait_for(conf) start = Time.now defaults = { :timeout => nil, :step => 0.125 } conf = defaults.update conf condition = false loop do condition = yield break if condition break if conf[:timeout] and Time.now - start > conf[:timeout] sleep conf[:step] end condition end |