Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update to latest flipper API.

  • Loading branch information...
commit 4affe21d3b46e1f506967d5423b741c6ad544745 1 parent c394b9a
John Nunemaker authored

Showing 2 changed files with 27 additions and 12 deletions. Show diff stats Hide diff stats

  1. +1 1  flipper-redis.gemspec
  2. +26 11 lib/flipper/adapters/redis.rb
2  flipper-redis.gemspec
@@ -15,6 +15,6 @@ Gem::Specification.new do |gem|
15 15 gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16 16 gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17 17
18   - gem.add_dependency 'flipper', '~> 0.5.0'
  18 + gem.add_dependency 'flipper', '~> 0.6.0'
19 19 gem.add_dependency 'redis', '~> 3.0.0'
20 20 end
37 lib/flipper/adapters/redis.rb
@@ -21,6 +21,32 @@ def initialize(client)
21 21 @name = :redis
22 22 end
23 23
  24 + # Public: The set of known features.
  25 + def features
  26 + @client.smembers(FeaturesKey).to_set
  27 + end
  28 +
  29 + # Public: Adds a feature to the set of known features.
  30 + def add(feature)
  31 + @client.sadd FeaturesKey, feature.name
  32 + true
  33 + end
  34 +
  35 + # Public: Removes a feature from the set of known features.
  36 + def remove(feature)
  37 + @client.multi do
  38 + @client.srem FeaturesKey, feature.name
  39 + @client.del feature.key
  40 + end
  41 + true
  42 + end
  43 +
  44 + # Public: Clears the gate values for a feature.
  45 + def clear(feature)
  46 + @client.del feature.key
  47 + true
  48 + end
  49 +
24 50 # Public: Gets the values for all gates for a given feature.
25 51 #
26 52 # Returns a Hash of Flipper::Gate#key => value.
@@ -85,17 +111,6 @@ def disable(feature, gate, thing)
85 111 true
86 112 end
87 113
88   - # Public: Adds a feature to the set of known features.
89   - def add(feature)
90   - @client.sadd FeaturesKey, feature.name
91   - true
92   - end
93   -
94   - # Public: The set of known features.
95   - def features
96   - @client.smembers(FeaturesKey).to_set
97   - end
98   -
99 114 # Private: Gets a hash of fields => values for the given feature.
100 115 #
101 116 # Returns a Hash of fields => values.

0 comments on commit 4affe21

Please sign in to comment.
Something went wrong with that request. Please try again.