about summary refs log tree commit diff
path: root/lib/redis/namespace_extensions.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-07-01 19:05:21 +0200
committerGitHub <noreply@github.com>2020-07-01 19:05:21 +0200
commit6d23d40420e4548778f3ca4ed9e8cb16e0eb0073 (patch)
tree814fe2ea2f3b6b8ab9db2d12b289ba49db44c8fd /lib/redis/namespace_extensions.rb
parente9ea960773ee6a1068623374b21d768918fbc93b (diff)
Change Redis#exists calls to Redis#exists? to avoid deprecation warning (#14191)
Diffstat (limited to 'lib/redis/namespace_extensions.rb')
-rw-r--r--lib/redis/namespace_extensions.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/redis/namespace_extensions.rb b/lib/redis/namespace_extensions.rb
new file mode 100644
index 000000000..310a4f465
--- /dev/null
+++ b/lib/redis/namespace_extensions.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class Redis
+  module NamespaceExtensions
+    def exists?(*args, &block)
+      call_with_namespace('exists?', *args, &block)
+    end
+  end
+end
+
+Redis::Namespace::COMMANDS['exists?'] = [:first]
+Redis::Namespace.prepend(Redis::NamespaceExtensions)