flipper-sequel 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/sequel.rb +30 -15
- 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: 90e3061ed905c5f60e924d150ab6528c9c0441cb
|
4
|
+
data.tar.gz: 427a99d66693ebd319e32b152167c7d6a1c5ca86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6427b163839819f4eb5bf9776553ddada04aab33b316f67b96d1ce4eea53b7c597ef622fa442588e491d545e41cd5751b34617a20981c3e36a8f47eeb3d2b35
|
7
|
+
data.tar.gz: 60da3d47612c6d2b559cb22c593bbcd8843c46ecebb2887110497c572378bf3df9b1976e5233701bb439fea627dae5b3a52ae9f4ac6a77e73fb680549f471659
|
@@ -72,22 +72,17 @@ module Flipper
|
|
72
72
|
def get(feature)
|
73
73
|
db_gates = @gate_class.where(feature_key: feature.key.to_s).all
|
74
74
|
|
75
|
-
feature
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
end
|
85
|
-
when :set
|
86
|
-
db_gates.select { |db_gate| db_gate.key == gate.key.to_s }.map(&:value).to_set
|
87
|
-
else
|
88
|
-
unsupported_data_type gate.data_type
|
89
|
-
end
|
75
|
+
result_for_feature(feature, db_gates)
|
76
|
+
end
|
77
|
+
|
78
|
+
def get_multi(features)
|
79
|
+
db_gates = @gate_class.where(feature_key: features.map(&:key)).to_a
|
80
|
+
grouped_db_gates = db_gates.group_by { |gate| gate.feature_key }
|
81
|
+
result = {}
|
82
|
+
features.each do |feature|
|
83
|
+
result[feature.key] = result_for_feature(feature, grouped_db_gates[feature.key])
|
90
84
|
end
|
85
|
+
result
|
91
86
|
end
|
92
87
|
|
93
88
|
# Public: Enables a gate for a given thing.
|
@@ -162,6 +157,26 @@ module Flipper
|
|
162
157
|
value: thing.value.to_s
|
163
158
|
}
|
164
159
|
end
|
160
|
+
|
161
|
+
def result_for_feature(feature, db_gates)
|
162
|
+
db_gates ||= []
|
163
|
+
feature.gates.each_with_object({}) do |gate, result|
|
164
|
+
result[gate.key] = case gate.data_type
|
165
|
+
when :boolean
|
166
|
+
if db_gate = db_gates.detect { |db_gate| db_gate.key == gate.key.to_s }
|
167
|
+
db_gate.value
|
168
|
+
end
|
169
|
+
when :integer
|
170
|
+
if db_gate = db_gates.detect { |db_gate| db_gate.key == gate.key.to_s }
|
171
|
+
db_gate.value
|
172
|
+
end
|
173
|
+
when :set
|
174
|
+
db_gates.select { |db_gate| db_gate.key == gate.key.to_s }.map(&:value).to_set
|
175
|
+
else
|
176
|
+
unsupported_data_type gate.data_type
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
165
180
|
end
|
166
181
|
end
|
167
182
|
end
|
data/lib/flipper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper-sequel
|
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: sequel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|