Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Accepting a single character from the keyboard in Ruby

By Peter Cooper / October 2, 2006

James Edward Gray II laments:

Every so often a person asks the question on Ruby Talk, "How can I get just one character from the keyboard (without needing the user to hit return)?" Everyone is always quick to post solutions, but sadly there are some issues with almost every one of them.

He moves on to look at a reasonably cross-platform solution called HighLine. This isn't very useful if you're just a Rails developer, but if you're creating Ruby apps to be used at the command line, it's gold.

(Update January 8, 2008: Thanks to Michael Fellinger for pointing out the above URL was broken. It is now fixed.)

Other Posts to Enjoy

Twitter Mentions