Class: Vedeu::Input
- Inherits:
-
Object
- Object
- Vedeu::Input
- Defined in:
- lib/vedeu/support/input.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#capture ⇒ Object
[].
- #initialize ⇒ Input constructor
- #input ⇒ String private private
- #keypress ⇒ String|Symbol private private
Constructor Details
Class Method Details
.capture ⇒ String|Symbol
5 6 7 |
# File 'lib/vedeu/support/input.rb', line 5 def self.capture new.capture end |
Instance Method Details
#capture ⇒ Object
Returns [].
13 14 15 |
# File 'lib/vedeu/support/input.rb', line 13 def capture Vedeu.trigger(:_keypress_, keypress) end |
#input ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/vedeu/support/input.rb', line 21 def input @_input ||= Terminal.input end |
#keypress ⇒ String|Symbol (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/vedeu/support/input.rb', line 27 def keypress key = input translated = case key when "\r" then :enter when "\t" then :tab when "\e" then :escape when "\e[A" then :up when "\e[B" then :down when "\e[C" then :right when "\e[D" then :left when "\e[5~" then :page_up when "\e[6~" then :page_down when "\e[H" then :home when "\e[3~" then :delete when "\e[F" then :end when "\e[Z" then :shift_tab when "\eOP" then :f1 when "\eOQ" then :f2 when "\eOR" then :f3 when "\eOS" then :f4 when "\e[15~" then :f5 when "\e[17~" then :f6 when "\e[18~" then :f7 when "\e[19~" then :f8 when "\e[20~" then :f9 when "\e[21~" then :f10 when "\e[23~" then :f11 when "\e[24~" then :f12 when "\e[1;2P" then :print_screen when "\e[1;2Q" then :scroll_lock when "\e[1;2R" then :pause_break when "\u007F" then :backspace else key end translated end |