Class: LCDProc::KeyEvent
- Inherits:
-
Object
- Object
- LCDProc::KeyEvent
- Defined in:
- lib/lcdproc/key_event.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Class Method Summary collapse
-
.new(key, &block) ⇒ Object
Creates a new KeyEvent object.
Instance Method Summary collapse
-
#initialize(key, &block) ⇒ KeyEvent
constructor
A new instance of KeyEvent.
Constructor Details
#initialize(key, &block) ⇒ KeyEvent
Returns a new instance of KeyEvent.
52 53 54 55 |
# File 'lib/lcdproc/key_event.rb', line 52 def initialize( key, &block ) @key = key @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
30 31 32 |
# File 'lib/lcdproc/key_event.rb', line 30 def block @block end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
30 31 32 |
# File 'lib/lcdproc/key_event.rb', line 30 def key @key end |
Class Method Details
.new(key, &block) ⇒ Object
Creates a new KeyEvent object. Note that this does not register it with a client, it only gives you a clean object to pass around.
-
key
- The key identifier. Valid values are “Escape”, “Enter”, “Up”, “Down”, “Left”, or “Right”. -
&block
- The block that you would like to associate with this key.
Example:
ke = KeyEvent.new( 'Enter' ) { puts 'Enter was pressed!' }
41 42 43 44 45 46 47 48 49 |
# File 'lib/lcdproc/key_event.rb', line 41 def self.new( key, &block ) if block.nil? return nil else super( key, &block ) end end |