Class: Key

Inherits:
Object
  • Object
show all
Defined in:
app/key.rb

Instance Method Summary collapse

Constructor Details

#initialize(ch) ⇒ Key

Returns a new instance of Key.



2
3
4
# File 'app/key.rb', line 2

def initialize(ch)
  @ch = ch
end

Instance Method Details

#buttonObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/key.rb', line 6

def button
  case @ch
  when 'k'
      :up
  when 'j'
    :down
  when 'o', 10
    :enter
  when 'q'
    :quit
  else
    logger.info("Pressed key is #{@ch}")
  end
end