hotkeys 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +2 -1
- data/lib/hotkeys/support/keys.rb +2 -2
- data/lib/hotkeys/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -9,7 +9,8 @@ A simple gem which allows you to bind global hot keys with macruby
|
|
9
9
|
Usage example:
|
10
10
|
`macruby examples/simple.rb`
|
11
11
|
|
12
|
-
require
|
12
|
+
require 'rubygems'
|
13
|
+
require 'hotkeys'
|
13
14
|
|
14
15
|
# Delegate method called when the app finished loading
|
15
16
|
def applicationDidFinishLaunching(notification)
|
data/lib/hotkeys/support/keys.rb
CHANGED
@@ -43,9 +43,9 @@ class HotKeys
|
|
43
43
|
keyModifiers = HotKeys::Support::Keys::Mappings.select {|key, value| key =~ /Key$/ }
|
44
44
|
keyCodes = HotKeys::Support::Keys::Mappings.select {|key, value| !(key =~ /Key$/) }
|
45
45
|
|
46
|
-
keyModifiersRegexPart = keyModifiers.map {|key, value| key.gsub(/Key$/, "")}.join("|")
|
46
|
+
keyModifiersRegexPart = keyModifiers.map {|key, value| key.gsub(/Key$/, "")}.sort_by {|x| x.length}.reverse.join("|")
|
47
47
|
keyModifiers = keyModifiers.map {|key, value| {key.gsub(/Key$/, "").to_s.downcase => value}}.inject({}) {|retval,hash| retval.merge(hash) }
|
48
|
-
keyCodesRegexPart = keyCodes.map {|key, value| key }.join("|")
|
48
|
+
keyCodesRegexPart = keyCodes.map {|key, value| key }.sort_by {|x| x.length}.reverse.join("|")
|
49
49
|
keyCodes = keyCodes.map {|key, value| {key.to_s.downcase => value}}.inject({}) {|retval,hash| retval.merge(hash) }
|
50
50
|
|
51
51
|
keyRegexString = "(#{keyCodesRegexPart})[\+]?(#{keyModifiersRegexPart})?[\+]?(#{keyModifiersRegexPart})?[\+]?(#{keyModifiersRegexPart})?"
|
data/lib/hotkeys/version.rb
CHANGED