From: Ben Thomas Date: 2006-11-12T04:30:06+09:00 Subject: Re: print message if user does nothing for x seconds? Hal Fulton wrote: > Ben Thomas wrote: >> Hi all, >> >> Only just started using ruby so this may be really simple to do, but >> here goes: >> >> I'm trying to write a program that asks a user to enter their sex >> using "gets" but if the user doesn't type anything for about 5 seconds >> I want to print a message, like "Please enter something..." then go >> back to the gets prompt. I've tried using the "sleep x" method but it >> doesn't seem to work because once gets has been initiated it gets >> stuck there until something is entered. >> >> Oh I don't have to use gets, but this is the only method of input I'm >> aware of at the moment > > > This is tricky on Windows... what platform are you on? > > Hal > Windows... D'oh! Is there any better ways to get input from the user that'd make is easier?