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 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 File.dirname(__FILE__) + '/lib/hotkeys'
12
+ require 'rubygems'
13
+ require 'hotkeys'
13
14
 
14
15
  # Delegate method called when the app finished loading
15
16
  def applicationDidFinishLaunching(notification)
@@ -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})?"
@@ -22,7 +22,7 @@ class Hotkeys
22
22
  module Version
23
23
  MAJOR = 0
24
24
  MINOR = 1
25
- PATCH = 0
25
+ PATCH = 1
26
26
  BUILD = nil
27
27
 
28
28
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hotkeys
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Rob Lowe