switch send for public_send

This commit is contained in:
onyx-and-iris 2023-08-31 22:54:08 +01:00
parent 350ebdd444
commit 42baa543fc
2 changed files with 5 additions and 5 deletions

View File

@ -207,9 +207,9 @@ module Voicemeeter
data.each do |key, hash|
case key.to_s.split("-")
in [/strip|bus|button/ => kls, /^[0-9]+$/ => index]
target = send(kls)
target = public_send(kls)
in ["vban", /in|instream|out|oustream/ => dir, /^[0-9]+$/ => index]
target = vban.send("#{dir.chomp("stream")}stream")
target = vban.public_send("#{dir.chomp("stream")}stream")
else
raise KeyError, "invalid config key '#{key}'"
end

View File

@ -37,12 +37,12 @@ module Voicemeeter
def apply(params)
params.each do |key, val|
if val.is_a? Hash
target = send(key)
target = pulic_send(key)
target.apply(val)
elsif key == :mode
mode.send("#{val}=", true)
mode.pulic_send("#{val}=", true)
else
send("#{key}=", val)
pulic_send("#{key}=", val)
end
end
end