# Set a timeout of 1 second on the execution of the loop
Timeout::timeout(1) do
# This loop will take 10 seconds to run
loop do
break if Time.now > Time.now + 10
end
end
# The timeout will be raised before the loop finishes
# => Timeout::Error: execution expired
Next: defer