Class: RSpecLive::KeyHandler
- Inherits:
-
Object
- Object
- RSpecLive::KeyHandler
- Defined in:
- lib/rspec-live/key_handler.rb
Instance Method Summary collapse
-
#initialize ⇒ KeyHandler
constructor
A new instance of KeyHandler.
- #on(*keys, &block) ⇒ Object
- #process_updates ⇒ Object
Constructor Details
#initialize ⇒ KeyHandler
Returns a new instance of KeyHandler.
3 4 5 |
# File 'lib/rspec-live/key_handler.rb', line 3 def initialize @event = {} end |
Instance Method Details
#on(*keys, &block) ⇒ Object
7 8 9 |
# File 'lib/rspec-live/key_handler.rb', line 7 def on(*keys, &block) keys.each { |key| @event[key] = block } end |
#process_updates ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/rspec-live/key_handler.rb', line 11 def process_updates any_processed = false while key = get_character_if_available handle key any_processed = true end any_processed end |