Class: TerminalGameEngine::Input

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

Defined Under Namespace

Modules: Keys

Class Method Summary collapse

Class Method Details

.call(&block) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/terminal_game_engine/input.rb', line 8

def self.call(&block)
  begin
    loop do
      key = $stdin.read_nonblock(1)
      block.call key
    end
  rescue Errno::EAGAIN
  end
end