module Hula::Helpers::TimeoutTools

Public Instance Methods

wait_for(error: nil, timeout_seconds:, &condition_block) click to toggle source
# File lib/hula/helpers/timeout_tools.rb, line 16
                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