From d06d09f479c5a0b4e911001d9c804521618c98f7 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 28 Sep 2021 11:11:18 +0900 Subject: [PATCH] Fix: Support Ruby 3 keyword arguments for DiscourseRedis (#14444) --- lib/discourse_redis.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/discourse_redis.rb b/lib/discourse_redis.rb index 33390d4ca6f..45902dcac4b 100644 --- a/lib/discourse_redis.rb +++ b/lib/discourse_redis.rb @@ -37,7 +37,7 @@ class DiscourseRedis end # prefix the key with the namespace - def method_missing(meth, *args, &block) + def method_missing(meth, *args, **kwargs, &block) if @redis.respond_to?(meth) DiscourseRedis.ignore_readonly { @redis.public_send(meth, *args, &block) } else @@ -54,9 +54,9 @@ class DiscourseRedis :sdiff, :set, :setbit, :setex, :setnx, :setrange, :sinter, :sismember, :smembers, :sort, :spop, :srandmember, :srem, :strlen, :sunion, :ttl, :type, :watch, :zadd, :zcard, :zcount, :zincrby, :zrange, :zrangebyscore, :zrank, :zrem, :zremrangebyrank, :zremrangebyscore, :zrevrange, :zrevrangebyscore, :zrevrank, :zrangebyscore ].each do |m| - define_method m do |*args| + define_method m do |*args, **kwargs| args[0] = "#{namespace}:#{args[0]}" if @namespace - DiscourseRedis.ignore_readonly { @redis.public_send(m, *args) } + DiscourseRedis.ignore_readonly { @redis.public_send(m, *args, **kwargs) } end end