mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
Fix: Support Ruby 3 keyword arguments for DiscourseRedis (#14444)
This commit is contained in:
parent
cd64e88711
commit
d06d09f479
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user