Is there any better way in Ruby to sleep until some condition is true ?
loop do sleep(1) if ready_to_go break end end
You can use the waitutil gem as described at http://rubytools.github.io/waitutil/, e.g.
waitutil
require 'waitutil' WaitUtil.wait_for_condition("my_event to happen", :timeout_sec => 30, :delay_sec => 0.5) do check_if_my_event_happened end