Class: Blight::RunsLoop
- Inherits:
-
Object
- Object
- Blight::RunsLoop
- Defined in:
- lib/blight.rb
Instance Method Summary collapse
Instance Method Details
#run(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/blight.rb', line 6 def run( = {}) config = .merge() begin Ncurses.initscr Ncurses.raw Ncurses.start_color if config[:color] config[:echo] ? Ncurses.echo : Ncurses.noecho yield window = Window.new while window.open? key = Ncurses.stdscr.getch config[:listeners].each { |l| l.listen({value: key.chr}, window) } end ensure Ncurses.endwin end end |