class Fir::Key

Attributes

input[R]

Public Class Methods

new(input) click to toggle source
# File lib/fir/key.rb, line 8
def initialize(input)
  @input = input
end

Public Instance Methods

get() click to toggle source
# File lib/fir/key.rb, line 12
def get
  input.raw do |raw_input|
    key = raw_input.sysread(1).chr
    if key == "\e"
      skt = Thread.new { 2.times { key += raw_input.sysread(1).chr } }
      skt.join(0.0001)
      skt.kill
    end
    key
  end
end