Skip to content

Commit

Permalink
Clean up based on review.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrussell committed Jun 11, 2020
1 parent 5c6bdae commit aa2a432
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/redis.rb
Expand Up @@ -9,9 +9,9 @@ class << self

def exists_returns_integer=(value)
unless value
message = "`Redis#exists(key)` will return an Integer in redis-rb 4.3. The option to explicitly disable this " \
"behaviour via `Redis.exists_returns_integer` will be removed. You should use `exists?` instead. " \
"(#{::Kernel.caller(1, 1).first})\n"
message = "`Redis#exists(key)` will return an Integer by default in redis-rb 4.3. The option to explicitly " \
"disable this behaviour via `Redis.exists_returns_integer` will be removed in 5.0. You should use `exists?` " \
"instead. "

::Kernel.warn(message)
end
Expand Down Expand Up @@ -574,11 +574,11 @@ def unlink(*keys)
# @return [Integer]
def exists(*keys)
if !Redis.exists_returns_integer && keys.size == 1
unless Redis.exists_returns_integer == false
message = "`Redis#exists(key)` will return an Integer in redis-rb 4.3, if you want to keep the old behavior, " \
"use `exists?` instead. To opt-in to the new behavior now you can set Redis.exists_returns_integer = true. " \
"To disable this message you can set `Redis.exists_returns_integer = false`, but this option will be " \
"removed in the next version. " \
if Redis.exists_returns_integer.nil?
message = "`Redis#exists(key)` will return an Integer in redis-rb 4.3. `exists?` returns a boolean, you should " \
"use it instead. To opt-in to the new behavior now you can set Redis.exists_returns_integer = true. " \
"To disable this message and keep the current (boolean) behaviour of 'exists' you can set "
"`Redis.exists_returns_integer = false`, but this option will be removed in 5.0. " \
"(#{::Kernel.caller(1, 1).first})\n"

::Kernel.warn(message)
Expand Down

0 comments on commit aa2a432

Please sign in to comment.