Module: Rum::KeyReader
Constant Summary collapse
- Hook =
proc do @pass_key = false if @key.modifier? if @down KeyReader.pressed_modifiers << @key elsif seen_key = KeyReader.pressed_modifiers.delete(@key) if @key == @last_key KeyReader.stop(@key, @pressed_modifiers) elsif @pressed_modifiers.values.compact.empty? KeyReader.stop end else @pass_key = true end elsif @down and not @was_executed[@key] KeyReader.stop(@key, @pressed_modifiers) end end
Instance Attribute Summary collapse
-
#pressed_modifiers ⇒ Object
Returns the value of attribute pressed_modifiers.
Instance Method Summary collapse
- #add_hooks ⇒ Object
- #remove_hooks ⇒ Object
- #start(hotkey_processor, proc) ⇒ Object
- #stop(key = nil, modifiers = nil) ⇒ Object
Instance Attribute Details
#pressed_modifiers ⇒ Object
Returns the value of attribute pressed_modifiers.
39 40 41 |
# File 'lib/rum/help.rb', line 39 def pressed_modifiers @pressed_modifiers end |
Instance Method Details
#add_hooks ⇒ Object
76 77 78 79 |
# File 'lib/rum/help.rb', line 76 def add_hooks @hotkey_processor.add_hook Hook Action.hook = lambda { |action| } # Ignore Actions. end |
#remove_hooks ⇒ Object
81 82 83 84 |
# File 'lib/rum/help.rb', line 81 def remove_hooks @hotkey_processor.remove_hook Hook Action.hook = nil end |
#start(hotkey_processor, proc) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/rum/help.rb', line 60 def start(hotkey_processor, proc) @hotkey_processor = hotkey_processor @proc = proc @pressed_modifiers = [] add_hooks end |