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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f80cbeee5c6dac769cca6483204f9d4e834a01fa
4
- data.tar.gz: 3b635749375a85edfb297cbc87c0af432339938f
3
+ metadata.gz: 8a13a83c0fcc0c673d0ec7f0eb384006701dda61
4
+ data.tar.gz: bd58070c270efaa9b84621e654e1f61e3dc2b027
5
5
  SHA512:
6
- metadata.gz: d0ef96187473bd0a8f8fa6a1d2f28a08485dd70ce375bd9e60a344f0c377ae1be2ae5fb6ccbf190d46cc7080be4f7e72ad7eea781b124f93197deff1239f019e
7
- data.tar.gz: c519c0f23f9e803d050599b787210c09a2f5de7013e08f0bce01f6fff5e6b1ff0e76ceaf0e836afad076dff8487c2b961b13d3e653b494b5ed8a6d608a19fd47
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
- fields = doc.keys
55
+ result_for_feature(feature, doc)
56
+ end
57
57
 
58
- feature.gates.each do |gate|
59
- result[gate.key] = case gate.data_type
60
- when :boolean, :integer
61
- doc[gate.key.to_s]
62
- when :set
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}"
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = "0.10.1".freeze
2
+ VERSION = "0.10.2".freeze
3
3
  end
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.1
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-19 00:00:00.000000000 Z
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.1
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.1
26
+ version: 0.10.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: redis
29
29
  requirement: !ruby/object:Gem::Requirement