Class: Vedeu::Input::Translator
- Inherits:
-
Object
- Object
- Vedeu::Input::Translator
- Defined in:
- lib/vedeu/input/translator.rb
Overview
Translates escape sequences provided by the terminal into symbols which Vedeu can use for various behaviours.
Instance Attribute Summary collapse
- #code ⇒ String readonly protected
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code) ⇒ Vedeu::Input::Translator
constructor
Returns a new instance of Vedeu::Input::Translator.
- #translate ⇒ Symbol
Constructor Details
#initialize(code) ⇒ Vedeu::Input::Translator
Returns a new instance of Vedeu::Input::Translator.
20 21 22 |
# File 'lib/vedeu/input/translator.rb', line 20 def initialize(code) @code = code end |
Instance Attribute Details
#code ⇒ String (readonly, protected)
33 34 35 |
# File 'lib/vedeu/input/translator.rb', line 33 def code @code end |
Class Method Details
.translate(code) ⇒ Symbol
12 13 14 |
# File 'lib/vedeu/input/translator.rb', line 12 def self.translate(code) new(code).translate end |
Instance Method Details
#translate ⇒ Symbol
25 26 27 |
# File 'lib/vedeu/input/translator.rb', line 25 def translate Vedeu::KEY_TABLE[code] || code end |