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