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.
23 24 25 26 27 28 |
# File 'lib/vedeu/input/key.rb', line 23 def initialize(input = nil, &block) raise Vedeu::Error::RequiresBlock unless block_given? @input = input @output = block end |
Instance Attribute Details
#input ⇒ String|Symbol (readonly) Also known as: key
Returns the key defined.
14 15 16 |
# File 'lib/vedeu/input/key.rb', line 14 def input @input end |
Instance Method Details
#output ⇒ |Symbol Also known as: action, press
Pressing the key will call the procedure.
33 34 35 |
# File 'lib/vedeu/input/key.rb', line 33 def output @output.call end |