-
-
Save 0x1eef/fb7dd44817118c8718497fe9a8523a6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'io/console' | |
def getch | |
c = STDIN.getch | |
if ('a'..'z').include?(c.downcase) | |
c | |
else | |
io = IO.select([STDIN], [], [], 0) | |
while io != nil | |
STDIN.getch | |
io = IO.select([STDIN], [], [], 0) | |
end | |
getch | |
end | |
end | |
p getch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment