Replace `while (true)` with `loop do`: `loop` is part of Ruby specifically for these infinite loops that are only stopped with `break`.