redis-aid 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/redis-aid.rb +1 -50
- data/lib/redis/aid.rb +47 -0
- data/lib/redis/aid/version.rb +16 -0
- data/redis-aid.gemspec +1 -1
- metadata +5 -3
data/Rakefile
CHANGED
data/lib/redis-aid.rb
CHANGED
@@ -1,50 +1 @@
|
|
1
|
-
require "redis"
|
2
|
-
require "nest"
|
3
|
-
|
4
|
-
class Redis
|
5
|
-
module Aid
|
6
|
-
|
7
|
-
class << self
|
8
|
-
def version
|
9
|
-
"0.0.1"
|
10
|
-
end
|
11
|
-
|
12
|
-
attr_accessor :redis
|
13
|
-
|
14
|
-
def redis
|
15
|
-
@redis ||= Redis.new
|
16
|
-
end
|
17
|
-
|
18
|
-
def Namespace(ns)
|
19
|
-
Redis::Aid.instance_variable_set("@ns", ns)
|
20
|
-
Redis::Aid
|
21
|
-
end
|
22
|
-
alias :Ns :Namespace
|
23
|
-
end # << self
|
24
|
-
|
25
|
-
module ClassMethods
|
26
|
-
attr_accessor :redis
|
27
|
-
|
28
|
-
def redis
|
29
|
-
@redis ||= Redis::Aid.redis
|
30
|
-
end
|
31
|
-
|
32
|
-
def ns=(namespace)
|
33
|
-
@redis = Nest.new(namespace, redis)
|
34
|
-
end
|
35
|
-
end # ClassMethods
|
36
|
-
|
37
|
-
module InstanceMethods
|
38
|
-
def redis
|
39
|
-
self.class.redis
|
40
|
-
end
|
41
|
-
end # InstanceMethods
|
42
|
-
|
43
|
-
def self.included(base) # :nodoc:
|
44
|
-
base.send :extend, ClassMethods
|
45
|
-
base.send :include, InstanceMethods
|
46
|
-
base.ns = @ns and @ns = nil if @ns
|
47
|
-
end
|
48
|
-
|
49
|
-
end # Aid
|
50
|
-
end # Redis
|
1
|
+
require "redis/aid"
|
data/lib/redis/aid.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require "redis"
|
2
|
+
require "nest"
|
3
|
+
require "redis/aid/version"
|
4
|
+
|
5
|
+
class Redis
|
6
|
+
module Aid
|
7
|
+
|
8
|
+
class << self
|
9
|
+
attr_accessor :redis
|
10
|
+
|
11
|
+
def redis
|
12
|
+
@redis ||= Redis.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def Namespace(ns)
|
16
|
+
Redis::Aid.instance_variable_set("@ns", ns)
|
17
|
+
Redis::Aid
|
18
|
+
end
|
19
|
+
alias :Ns :Namespace
|
20
|
+
end # << self
|
21
|
+
|
22
|
+
module ClassMethods
|
23
|
+
attr_accessor :redis
|
24
|
+
|
25
|
+
def redis
|
26
|
+
@redis ||= Redis::Aid.redis
|
27
|
+
end
|
28
|
+
|
29
|
+
def ns=(namespace)
|
30
|
+
@redis = Nest.new(namespace, redis)
|
31
|
+
end
|
32
|
+
end # ClassMethods
|
33
|
+
|
34
|
+
module InstanceMethods
|
35
|
+
def redis
|
36
|
+
self.class.redis
|
37
|
+
end
|
38
|
+
end # InstanceMethods
|
39
|
+
|
40
|
+
def self.included(base) # :nodoc:
|
41
|
+
base.send :extend, ClassMethods
|
42
|
+
base.send :include, InstanceMethods
|
43
|
+
base.ns = @ns and @ns = nil if @ns
|
44
|
+
end
|
45
|
+
|
46
|
+
end # Aid
|
47
|
+
end # Redis
|
data/redis-aid.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-aid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Kowalik
|
@@ -93,6 +93,8 @@ files:
|
|
93
93
|
- README.rdoc
|
94
94
|
- Rakefile
|
95
95
|
- lib/redis-aid.rb
|
96
|
+
- lib/redis/aid.rb
|
97
|
+
- lib/redis/aid/version.rb
|
96
98
|
- redis-aid.gemspec
|
97
99
|
- spec/redis_aid_spec.rb
|
98
100
|
- spec/spec_helper.rb
|