lib/ppcurses/actions/GetBooleanAction.rb in ppcurses-0.0.25 vs lib/ppcurses/actions/GetBooleanAction.rb in ppcurses-0.1.0
- old
+ new
@@ -23,20 +23,20 @@
def execute
print_prompt
# Enables reading arrow keys in getch
@win.keypad(true)
while 1
- noecho
+ Curses.noecho
c = @win.getch
- if c == KEY_LEFT then @state = false end
- if c == KEY_RIGHT then @state = true end
- if c == 10 then break end
+ if c == Curses::KEY_LEFT then @state = false end
+ if c == Curses::KEY_RIGHT then @state = true end
+ if c == ESCAPE then break end
- echo
+ Curses.echo
print_prompt
end
- echo
+ Curses.echo
end
def data
if @state then return '1' end
'0'