Skip to content

Instantly share code, notes, and snippets.

@takkaw
Created August 25, 2008 17:32
Show Gist options
  • Select an option

  • Save takkaw/7120 to your computer and use it in GitHub Desktop.

Select an option

Save takkaw/7120 to your computer and use it in GitHub Desktop.
# Another getc method with Curses module.
# You can get only one character.
module Curses
def self.curses_proc
Curses::init_screen
ret = yield
Curses::close_screen
return ret
end
end
def getc
require 'curses'
Curses::curses_proc {
Curses::getch
}
end
# usage
if __FILE__ == $0
puts getc
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment