Module: Hula::Helpers::TimeoutTools
- Defined in:
- lib/hula/helpers/timeout_tools.rb
Class Method Summary collapse
Class Method Details
.wait_for(error: nil, timeout_seconds:, &condition_block) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/hula/helpers/timeout_tools.rb', line 16 module_function def wait_for(error: nil, timeout_seconds:, &condition_block) Timeout::timeout(timeout_seconds) do until condition_block.call do sleep 0.1 end end rescue Timeout::Error => e error ? raise(error) : raise(e) end |