From: Rico Knoop Date: 2010-03-26T20:59:42+09:00 Subject: Re: user input timeout. Jesús Gabriel y Galán wrote: > On Fri, Mar 26, 2010 at 10:17 AM, Rico Knoop wrote: >> >> if input == "empty" >> �puts "no input" >> else >> �puts input >> end >> >> all i want it to do is wait like 10 seconds and if there has bin no user >> input it should just continue with input= "empty" >> >> i feel like i'm missing something real simple > > Timeout is in the standard lib: > > require 'timeout' > > begin > answer = Timeout::timeout(5) do > gets > end > rescue Timeout::Error > answer = "empty" > end > > puts answer > > Jesus. it didn't seem to work, it just kept waiting for me to input something. i even tried to run just that code. its still blinking, waiting for input on the background. am i doing something wrong? -- Posted via http://www.ruby-forum.com/.