flipper-redis 0.25.1 → 0.25.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
  SHA256:
3
- metadata.gz: 8b7131af89e261ecbff16099802e59f50fb2cdd71a761c3b0cb19dc18122fe85
4
- data.tar.gz: 9d002c2225bf2d3edcf8cdad97ad83fa31885748f771fc73d68b881a5a243fe1
3
+ metadata.gz: 13389e639f482e51952030304e02d945aab43ca406ec67daf3f591117160c726
4
+ data.tar.gz: 575f21419f14fab17ebe8d88ae919f2ba127ff580cb21892025abed8e6c0c19e
5
5
  SHA512:
6
- metadata.gz: b22f75f217bef79ce89384ee004e09a507e521149bd1274fd13a143ce201e8ae1ac18da566a6d8b39e9d4ce67700001db93326c0123c2db920679b20fad0e31d
7
- data.tar.gz: 4fedae8289ac0b72ec52dcb16759423a0d0277cd7e3d76f7ed89d02600a7cc0a70623f742ab0ec68aa71491f7597d072ef93cc70f232e861cff36c816f4b8cd5
6
+ metadata.gz: 1e2e6fc9c924156f2092c40459543413ec061e9b78fcdd60490cef98bc8cab9096d7e72c6c2568ec66c59f7d06da4839658fc9c01d725eb17f58edbedabc5b55
7
+ data.tar.gz: 0365d12dbfb9dfcff20cd92c1458b97f7b8ba20422ca04fd28b50dcd77f513471b0862251e870c28002eeed873e9906031505aae5e776b4f3fc5a8f97bb990c8
@@ -28,13 +28,21 @@ module Flipper
28
28
 
29
29
  # Public: Adds a feature to the set of known features.
30
30
  def add(feature)
31
- @client.sadd FeaturesKey, feature.key
31
+ if redis_sadd_returns_boolean?
32
+ @client.sadd? FeaturesKey, feature.key
33
+ else
34
+ @client.sadd FeaturesKey, feature.key
35
+ end
32
36
  true
33
37
  end
34
38
 
35
39
  # Public: Removes a feature from the set of known features.
36
40
  def remove(feature)
37
- @client.srem FeaturesKey, feature.key
41
+ if redis_sadd_returns_boolean?
42
+ @client.srem? FeaturesKey, feature.key
43
+ else
44
+ @client.srem FeaturesKey, feature.key
45
+ end
38
46
  @client.del feature.key
39
47
  true
40
48
  end
@@ -109,6 +117,10 @@ module Flipper
109
117
 
110
118
  private
111
119
 
120
+ def redis_sadd_returns_boolean?
121
+ ::Redis.respond_to?(:sadd_returns_boolean) && ::Redis.sadd_returns_boolean
122
+ end
123
+
112
124
  def read_many_features(features)
113
125
  docs = docs_for(features)
114
126
  result = {}
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.25.1'.freeze
2
+ VERSION = '0.25.2'.freeze
3
3
  end
@@ -6,6 +6,7 @@ RSpec.describe Flipper::Adapters::Redis do
6
6
 
7
7
  options[:url] = ENV['REDIS_URL'] if ENV['REDIS_URL']
8
8
 
9
+ Redis.raise_deprecations = true
9
10
  Redis.new(options)
10
11
  end
11
12
 
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.25.1
4
+ version: 0.25.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: 2022-08-19 00:00:00.000000000 Z
11
+ date: 2022-08-25 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.25.1
19
+ version: 0.25.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.25.1
26
+ version: 0.25.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: redis
29
29
  requirement: !ruby/object:Gem::Requirement