rails_kvs_driver 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/rails_kvs_driver/defined_base_method.rb +3 -0
- data/lib/rails_kvs_driver/sorted_set.rb +14 -3
- data/lib/rails_kvs_driver/version.rb +1 -1
- data/rails_kvs_driver.gemspec +2 -2
- data/spec/common_example.rb +12 -2
- data/spec/rails_kvs_driver/sorted_set_spec.rb +4 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65825db278e173b70e7356bebb71e1706be19cbe
|
4
|
+
data.tar.gz: feb19bf2dcb02b2499395c27c71bb3523bb41dce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38119d7f68efb358baa88241b1a777102390b058110d760034539a6745e4edaad041bd455ea3679d8c0baa77483a950bf867ec16993fe08f851f0444c622eb75
|
7
|
+
data.tar.gz: 7fc6b26b52371aa7807240ebb1f06eadc10a8739b679c7e8dc8643857a8076b9a9481385f11d2b3051e32cc193391816b25e9fa33331ffe942d6355eafabeee1
|
data/README.md
CHANGED
@@ -24,6 +24,10 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
* [rails_kvs_driver-redis_driver](https://github.com/alfa-jpn/rails_kvs_driver-redis_driver)
|
26
26
|
|
27
|
+
## API Document
|
28
|
+
|
29
|
+
* [RailsKvsDriver](http://rubydoc.info/github/alfa-jpn/rails-kvs-driver/frames)
|
30
|
+
|
27
31
|
## Contributing
|
28
32
|
|
29
33
|
1. Fork it
|
@@ -11,6 +11,7 @@ module RailsKvsDriver
|
|
11
11
|
|
12
12
|
# return initialized SortedSet class.
|
13
13
|
#
|
14
|
+
# @return [RailsKvsDriver::SortedSet] SortedSet
|
14
15
|
def sorted_sets
|
15
16
|
RailsKvsDriver::SortedSet.new(self)
|
16
17
|
end
|
@@ -30,6 +31,8 @@ module RailsKvsDriver
|
|
30
31
|
end
|
31
32
|
|
32
33
|
# get length of keys.
|
34
|
+
#
|
35
|
+
# @return [Integer]length of keys.
|
33
36
|
def length
|
34
37
|
keys.length
|
35
38
|
end
|
@@ -72,14 +72,23 @@ module RailsKvsDriver
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
# check key in sorted set
|
75
|
+
# check key in sorted set.
|
76
76
|
#
|
77
|
-
# @param key [String] key name
|
78
|
-
# @return [Boolean] result
|
77
|
+
# @param key [String] key name.
|
78
|
+
# @return [Boolean] result.
|
79
79
|
def has_key?(key)
|
80
80
|
!(self[key].nil?)
|
81
81
|
end
|
82
82
|
|
83
|
+
# check member in sorted set.
|
84
|
+
#
|
85
|
+
# @param key [String] key name.
|
86
|
+
# @param member [String] member name.
|
87
|
+
# @return [Boolean] result.
|
88
|
+
def has_member?(key, member)
|
89
|
+
!(self[key, member].nil?)
|
90
|
+
end
|
91
|
+
|
83
92
|
# increment member's score of sorted set.
|
84
93
|
#
|
85
94
|
# @param key [String] key of sorted set.
|
@@ -98,6 +107,8 @@ module RailsKvsDriver
|
|
98
107
|
end
|
99
108
|
|
100
109
|
# get length of sorted_set.
|
110
|
+
#
|
111
|
+
# @return [Integer] length of keys.
|
101
112
|
def length
|
102
113
|
keys.length
|
103
114
|
end
|
data/rails_kvs_driver.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = RailsKvsDriver::VERSION
|
9
9
|
spec.authors = ["alfa-jpn"]
|
10
10
|
spec.email = ["a.nkmr.ja@gmail.com"]
|
11
|
-
spec.description = "
|
12
|
-
spec.summary = "
|
11
|
+
spec.description = "rails_kvs_driver is available to use namespace and connection pool and ruby-like methods of kvs."
|
12
|
+
spec.summary = "rails_kvs_driver is available to use namespace and connection pool and ruby-like methods of kvs."
|
13
13
|
spec.homepage = "https://github.com/alfa-jpn/rails-kvs-driver"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/spec/common_example.rb
CHANGED
@@ -242,8 +242,18 @@ shared_examples_for 'RailsKvsDriver example' do |driver_class, driver_config|
|
|
242
242
|
driver_class::session(driver_config) do |kvs|
|
243
243
|
kvs.add_sorted_set('example', 'element', 10)
|
244
244
|
|
245
|
-
expect(kvs.sorted_sets.has_key?('example')).to
|
246
|
-
expect(kvs.sorted_sets.has_key?('nothing key')).to
|
245
|
+
expect(kvs.sorted_sets.has_key?('example')).to be_true
|
246
|
+
expect(kvs.sorted_sets.has_key?('nothing key')).to be_false
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'call has_member?' do
|
251
|
+
driver_class::session(driver_config) do |kvs|
|
252
|
+
kvs.add_sorted_set('example', 'element', 10)
|
253
|
+
|
254
|
+
expect(kvs.sorted_sets.has_member?('example','element')).to be_true
|
255
|
+
expect(kvs.sorted_sets.has_member?('example','nothing member')).to be_false
|
256
|
+
expect(kvs.sorted_sets.has_member?('nothing key', 'element')).to be_false
|
247
257
|
end
|
248
258
|
end
|
249
259
|
|
@@ -65,6 +65,10 @@ describe RailsKvsDriver::SortedSet do
|
|
65
65
|
expect(@driver.sorted_sets.has_key?(:a)).to be_true
|
66
66
|
end
|
67
67
|
|
68
|
+
it 'call has_member?' do
|
69
|
+
expect(@driver.sorted_sets.has_member?(:a,:b)).to be_true
|
70
|
+
end
|
71
|
+
|
68
72
|
it 'call length' do
|
69
73
|
expect(@driver.sorted_sets.length).to eq(3)
|
70
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_kvs_driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alfa-jpn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,7 +80,8 @@ dependencies:
|
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description:
|
83
|
+
description: rails_kvs_driver is available to use namespace and connection pool and
|
84
|
+
ruby-like methods of kvs.
|
84
85
|
email:
|
85
86
|
- a.nkmr.ja@gmail.com
|
86
87
|
executables: []
|
@@ -129,7 +130,8 @@ rubyforge_project:
|
|
129
130
|
rubygems_version: 2.0.3
|
130
131
|
signing_key:
|
131
132
|
specification_version: 4
|
132
|
-
summary:
|
133
|
+
summary: rails_kvs_driver is available to use namespace and connection pool and ruby-like
|
134
|
+
methods of kvs.
|
133
135
|
test_files:
|
134
136
|
- spec/common_example.rb
|
135
137
|
- spec/rails_kvs_driver/defined_base_method_spec.rb
|