Skip to content

Instantly share code, notes, and snippets.

@AlexandrBasan
Created December 19, 2016 21:27
Show Gist options
  • Save AlexandrBasan/e0a21ee432db739a8edca879b8dcfe4d to your computer and use it in GitHub Desktop.
Save AlexandrBasan/e0a21ee432db739a8edca879b8dcfe4d to your computer and use it in GitHub Desktop.
Rails Timeout
require 'timeout'
begin
complete_results = Timeout.timeout(1) do
sleep(2)
end
rescue Timeout::Error
puts 'Print me something please'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment