Guest User

Untitled

a guest
Feb 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. # Another getc method with Curses module.
  2. # You can get only one character.
  3. module Curses
  4. def self.curses_proc
  5. Curses::init_screen
  6. ret = yield
  7. Curses::close_screen
  8. return ret
  9. end
  10. end
  11.  
  12. def getc
  13. require 'curses'
  14. Curses::curses_proc {
  15. Curses::getch
  16. }
  17. end
  18.  
  19. # usage
  20. if __FILE__ == $0
  21. puts getc
  22. end
Add Comment
Please, Sign In to add comment