Class: Vedeu::Input::Translator

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Vedeu::Input::Translator

Returns a new instance of Vedeu::Input::Translator.



22
23
24
# File 'lib/vedeu/input/translator.rb', line 22

def initialize(code)
  @code = code
end

Instance Attribute Details

#codeString (readonly, protected)



35
36
37
# File 'lib/vedeu/input/translator.rb', line 35

def code
  @code
end

Class Method Details

.translate(code) ⇒ Symbol



14
15
16
# File 'lib/vedeu/input/translator.rb', line 14

def self.translate(code)
  new(code).translate
end

Instance Method Details

#translateSymbol



27
28
29
# File 'lib/vedeu/input/translator.rb', line 27

def translate
  Vedeu::KEY_TABLE[code] || code
end