flipper-redis 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flipper/adapters/redis.rb +33 -12
- data/lib/flipper/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a13a83c0fcc0c673d0ec7f0eb384006701dda61
|
4
|
+
data.tar.gz: bd58070c270efaa9b84621e654e1f61e3dc2b027
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fbbb7cb31fd3007f6afbfeb0db8915a9b067c2b977675bea6d127bb6bc32e070e837a1572e56e8099b1b998958de4526acb72d97407267470331805df5aa938
|
7
|
+
data.tar.gz: 4bb7a22274f4c5666f02e9f887d5ecaaa9de717f1c823f317f5160be548e9138d2b0d427b6a342c1626c7124643199813a61946ec904f3d424a0c01fd0f7e4a5
|
@@ -51,21 +51,16 @@ module Flipper
|
|
51
51
|
#
|
52
52
|
# Returns a Hash of Flipper::Gate#key => value.
|
53
53
|
def get(feature)
|
54
|
-
result = {}
|
55
54
|
doc = doc_for(feature)
|
56
|
-
|
55
|
+
result_for_feature(feature, doc)
|
56
|
+
end
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
fields_to_gate_value fields, gate
|
64
|
-
else
|
65
|
-
unsupported_data_type gate.data_type
|
66
|
-
end
|
58
|
+
def get_multi(features)
|
59
|
+
docs = docs_for(features)
|
60
|
+
result = {}
|
61
|
+
features.zip(docs) do |feature, doc|
|
62
|
+
result[feature.key] = result_for_feature(feature, doc)
|
67
63
|
end
|
68
|
-
|
69
64
|
result
|
70
65
|
end
|
71
66
|
|
@@ -118,6 +113,32 @@ module Flipper
|
|
118
113
|
@client.hgetall(feature.key)
|
119
114
|
end
|
120
115
|
|
116
|
+
def docs_for(features)
|
117
|
+
@client.pipelined do
|
118
|
+
features.each do |feature|
|
119
|
+
doc_for(feature)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def result_for_feature(feature, doc)
|
125
|
+
result = {}
|
126
|
+
fields = doc.keys
|
127
|
+
|
128
|
+
feature.gates.each do |gate|
|
129
|
+
result[gate.key] = case gate.data_type
|
130
|
+
when :boolean, :integer
|
131
|
+
doc[gate.key.to_s]
|
132
|
+
when :set
|
133
|
+
fields_to_gate_value fields, gate
|
134
|
+
else
|
135
|
+
unsupported_data_type gate.data_type
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
result
|
140
|
+
end
|
141
|
+
|
121
142
|
# Private: Converts gate and thing to hash key.
|
122
143
|
def to_field(gate, thing)
|
123
144
|
"#{gate.key}/#{thing.value}"
|
data/lib/flipper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flipper
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.10.
|
19
|
+
version: 0.10.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.10.
|
26
|
+
version: 0.10.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|