Class: Vedeu::Input::Translator Private

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/input/translator.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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

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.

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

Parameters:

  • code (String)


24
25
26
# File 'lib/vedeu/input/translator.rb', line 24

def initialize(code)
  @code = code
end

Instance Attribute Details

#codeString (readonly, protected)

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.

Returns:

  • (String)


37
38
39
# File 'lib/vedeu/input/translator.rb', line 37

def code
  @code
end

Class Method Details

.translate(code) ⇒ Symbol

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.

Parameters:

  • code (String)

Returns:

  • (Symbol)


16
17
18
# File 'lib/vedeu/input/translator.rb', line 16

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

Instance Method Details

#translateSymbol

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.

Returns:

  • (Symbol)


29
30
31
# File 'lib/vedeu/input/translator.rb', line 29

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