Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support new key object instead of string.

  • Loading branch information...
commit cfbadd9121ee5e53badf3f3be7cf2c67ad0559b5 1 parent 4fa00c1
@jnunemaker authored
Showing with 10 additions and 10 deletions.
  1. +6 −6 lib/flipper/adapters/redis.rb
  2. +4 −4 spec/flipper/redis_spec.rb
View
12 lib/flipper/adapters/redis.rb
@@ -9,27 +9,27 @@ def initialize(client)
end
def read(key)
- @client.get key
+ @client.get key.to_s
end
def write(key, value)
- @client.set key, value
+ @client.set key.to_s, value
end
def delete(key)
- @client.del key
+ @client.del key.to_s
end
def set_add(key, value)
- @client.sadd(key, value)
+ @client.sadd(key.to_s, value)
end
def set_delete(key, value)
- @client.srem(key, value)
+ @client.srem(key.to_s, value)
end
def set_members(key)
- @client.smembers(key).map { |member| member.to_i }.to_set
+ @client.smembers(key.to_s).map { |member| member.to_i }.to_set
end
end
end
View
8 spec/flipper/redis_spec.rb
@@ -12,10 +12,10 @@
end
def read_key(key)
- client.get key
+ client.get key.to_s
rescue RuntimeError => e
if e.message =~ /wrong kind of value/
- client.smembers(key).map { |member| member.to_i }.to_set
+ client.smembers(key.to_s).map { |member| member.to_i }.to_set
else
raise
end
@@ -25,10 +25,10 @@ def write_key(key, value)
case value
when Array, Set
value.each do |member|
- client.sadd key, member
+ client.sadd key.to_s, member
end
else
- client.set key, value
+ client.set key.to_s, value
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.