Class: Vedeu::Key
- Inherits:
-
Object
- Object
- Vedeu::Key
- Defined in:
- lib/vedeu/input/key.rb
Overview
A single keypress or combination of keypresses bound to a specific action.
Instance Method Summary collapse
-
#initialize(input = nil, &block) ⇒ Key
constructor
Returns a new instance of Key.
-
#input ⇒ String|Symbol
(also: #key)
Returns the key defined.
-
#output ⇒ |Symbol
(also: #action, #press)
Pressing the key will call the procedure.
Constructor Details
#initialize(input = nil, &block) ⇒ Key
Returns a new instance of Key.
13 14 15 16 17 18 |
# File 'lib/vedeu/input/key.rb', line 13 def initialize(input = nil, &block) fail InvalidSyntax, 'block not given' unless block_given? @input = input @output = block end |
Instance Method Details
#input ⇒ String|Symbol Also known as: key
Returns the key defined.
23 24 25 |
# File 'lib/vedeu/input/key.rb', line 23 def input @input end |
#output ⇒ |Symbol Also known as: action, press
Pressing the key will call the procedure.
31 32 33 |
# File 'lib/vedeu/input/key.rb', line 31 def output @output.call end |