On Aug 25, 2007, at 3:36 PM, Dan Zwell wrote:

> Barr, Keith wrote:
>> Hi there,
>>  I am new to using Ruby and I am writing my first real programs  
>> and I have something I was wonndering about:
>>  I have a menu that I would like users to respond to simply by  
>> entering a single character.  I have tried both STDIN.getc and  
>> gets, but both require a carriage return.  Is there a command I  
>> haven't found that will actively read STDIN to process a single  
>> character as soon as it is entered?
>>  Thanks in advance,
>> Keith
>
> This is a common question. You need a library (gem) that provides  
> this function. I have heard that highline, ncurses, and termios  
> have this. In ncurses, it's called "getch", but I don't know about  
> the others.

Here's how you do it with HighLine:

http://blog.grayproductions.net/articles/i_just_want_one_character

James Edward Gray II