Class: Roku::Input

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

Constant Summary collapse

BINDINGS =
{
  ' ' => :Play,
  "\r" => :Select,
  "\e[A" => :Up,
  "\e[B" => :Down,
  "\e[C" => :Right,
  "\e[D" => :Left,
  "\e[1;5A" => :VolumeUp,
  "\e[1;5B" => :VolumeDown,
  "\u007F" => :Back
}.freeze

Instance Method Summary collapse

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/roku/input.rb', line 17

def run
  while (input = read_char)
    case input
    when 'a'
      launch_app(prompt('Launch: '))
    when 'q', "\u0003", "\e"
      break
    when *BINDINGS.keys
      Roku::Client.keypress(BINDINGS[input])
    else
      puts input.inspect
    end
  end
end