qmin 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/qmin/core_ext/string.rb +35 -15
- data/lib/qmin/version.rb +1 -1
- metadata +21 -5
- checksums.yaml +0 -7
data/lib/qmin/core_ext/string.rb
CHANGED
@@ -1,23 +1,43 @@
|
|
1
|
-
|
1
|
+
class String
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
3
|
+
def underscore
|
4
|
+
self.to_s.gsub(/::/, '/').
|
5
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
6
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
7
|
+
tr('-', '_').
|
8
|
+
downcase
|
9
|
+
end unless String.respond_to?(:underscore)
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
# shamelessly stolen from resque
|
12
|
+
def constantize
|
13
|
+
names = self.split('::')
|
14
|
+
names.shift if names.empty? || names.first.empty?
|
16
15
|
|
17
|
-
|
16
|
+
names.inject(Object) do |constant, name|
|
17
|
+
if constant == Object
|
18
|
+
constant.const_get(name)
|
19
|
+
else
|
20
|
+
candidate = constant.const_get(name)
|
21
|
+
args = Module.method(:const_defined?).arity != 1 ? [false] : []
|
22
|
+
next candidate if constant.const_defined?(name, *args)
|
23
|
+
next candidate unless Object.const_defined?(name)
|
24
|
+
|
25
|
+
# Go down the ancestors to check it it's owned
|
26
|
+
# directly before we reach Object or the end of ancestors.
|
27
|
+
constant = constant.ancestors.inject do |const, ancestor|
|
28
|
+
break const if ancestor == Object
|
29
|
+
break ancestor if ancestor.const_defined?(name, *args)
|
30
|
+
const
|
31
|
+
end
|
32
|
+
|
33
|
+
# owner is in Object, so raise
|
34
|
+
constant.const_get(name, false)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end unless String.respond_to?(:constantize)
|
18
38
|
|
19
|
-
class String
|
20
39
|
def to_queue_name
|
21
40
|
gsub('::','').underscore
|
22
41
|
end
|
42
|
+
|
23
43
|
end
|
data/lib/qmin/version.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- the-architect
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - '>='
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - '>='
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rake
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - '>='
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - '>='
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -41,6 +46,7 @@ dependencies:
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: rspec
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - '>='
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - '>='
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: mocha
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - '>='
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - '>='
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -104,26 +113,33 @@ files:
|
|
104
113
|
homepage: https://github.com/qmin/qmin
|
105
114
|
licenses:
|
106
115
|
- MIT
|
107
|
-
metadata: {}
|
108
116
|
post_install_message:
|
109
117
|
rdoc_options: []
|
110
118
|
require_paths:
|
111
119
|
- lib
|
112
120
|
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
113
122
|
requirements:
|
114
123
|
- - '>='
|
115
124
|
- !ruby/object:Gem::Version
|
116
125
|
version: '0'
|
126
|
+
segments:
|
127
|
+
- 0
|
128
|
+
hash: -2111192109713405080
|
117
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
118
131
|
requirements:
|
119
132
|
- - '>='
|
120
133
|
- !ruby/object:Gem::Version
|
121
134
|
version: '0'
|
135
|
+
segments:
|
136
|
+
- 0
|
137
|
+
hash: -2111192109713405080
|
122
138
|
requirements: []
|
123
139
|
rubyforge_project:
|
124
|
-
rubygems_version:
|
140
|
+
rubygems_version: 1.8.25
|
125
141
|
signing_key:
|
126
|
-
specification_version:
|
142
|
+
specification_version: 3
|
127
143
|
summary: Simple framwork to coordinate background tasks
|
128
144
|
test_files:
|
129
145
|
- spec/qmin/core_ext/class_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 43fbea2d8af2608d83b22a3dce04abb38bec4e64
|
4
|
-
data.tar.gz: cfd53ca11ac9302d8412c52a4ff26f5ce0a46da3
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 11ff0a9e5d79d9227161c666d0da69953119e5d8d821da42bb07f71363f413a6d7ee9994648885587181d131ad0625f18783bd153193df388a1a69bf75360b03
|
7
|
-
data.tar.gz: 4679da2a22b7a7f1f8e80f2485b0d46a96cdb93c48528f651ffca88b045454253dd9b5f321c47e9b22858ee0e653792f4e821d495ffe703230a37456ddf516e2
|