Class: Yatte::Input
- Inherits:
-
Object
- Object
- Yatte::Input
- Defined in:
- lib/yatte/input.rb
Constant Summary collapse
- ARROW_UP =
:arrow_up- ARROW_DOWN =
:arrow_down- ARROW_LEFT =
:arrow_left- ARROW_RIGHT =
:arrow_right- CTRL_ARROW_LEFT =
:ctrl_arrow_left- CTRL_ARROW_RIGHT =
:ctrl_arrow_right- CTRL_HOME =
:ctrl_home- CTRL_END =
:ctrl_end- SHIFT_ARROW_UP =
:shift_arrow_up- SHIFT_ARROW_DOWN =
:shift_arrow_down- SHIFT_ARROW_LEFT =
:shift_arrow_left- SHIFT_ARROW_RIGHT =
:shift_arrow_right- ALT_ARROW_LEFT =
:alt_arrow_left- ALT_ARROW_RIGHT =
:alt_arrow_right- BACKSPACE =
:backspace- DELETE =
:delete- ENTER =
:enter- ESCAPE =
:escape- HOME =
:home- END_KEY =
:end_key- PAGE_UP =
:page_up- PAGE_DOWN =
:page_down
Instance Method Summary collapse
-
#initialize(terminal) ⇒ Input
constructor
A new instance of Input.
- #read_keypress ⇒ Object
- #read_keypress_nonblocking ⇒ Object
Constructor Details
#initialize(terminal) ⇒ Input
Returns a new instance of Input.
28 29 30 |
# File 'lib/yatte/input.rb', line 28 def initialize(terminal) @terminal = terminal end |
Instance Method Details
#read_keypress ⇒ Object
32 33 34 35 36 37 |
# File 'lib/yatte/input.rb', line 32 def read_keypress byte = @terminal.read_byte return nil unless byte parse_byte(byte) end |
#read_keypress_nonblocking ⇒ Object
39 40 41 42 43 44 |
# File 'lib/yatte/input.rb', line 39 def read_keypress_nonblocking byte = @terminal.read_byte_nonblocking(timeout: 0) return nil unless byte parse_byte(byte) end |