Class: Vedeu::Input::Raw Private

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/input/raw.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.

Handle input when terminal is in :raw (character at a time) mode.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeVedeu::Input::Raw

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::Raw.



22
# File 'lib/vedeu/input/raw.rb', line 22

def initialize; end

Class Method Details

.readObject

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.

See Also:



15
16
17
# File 'lib/vedeu/input/raw.rb', line 15

def self.read
  new.read
end

Instance Method Details

#consoleIO (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.



40
41
42
# File 'lib/vedeu/input/raw.rb', line 40

def console
  @_console ||= Vedeu::Terminal.console
end

#readString

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.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/vedeu/input/raw.rb', line 25

def read
  keys = console.getch

  if keys.ord == Vedeu::ESCAPE_KEY_CODE
    keys << console.read_nonblock(4) rescue nil
    keys << console.read_nonblock(3) rescue nil
    keys << console.read_nonblock(2) rescue nil
  end

  keys
end