mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-22 01:40:49 +00:00
raise a KeyError if the config key is invalid
This commit is contained in:
parent
2a191dccb8
commit
2ca66a5925
@ -220,12 +220,15 @@ module Voicemeeter
|
|||||||
def apply(data)
|
def apply(data)
|
||||||
data.each do |key, val|
|
data.each do |key, val|
|
||||||
kls, index, *rem = key.to_s.split("-")
|
kls, index, *rem = key.to_s.split("-")
|
||||||
if rem.empty?
|
case kls
|
||||||
|
when "strip", "bus", "button"
|
||||||
target = send(kls)
|
target = send(kls)
|
||||||
else
|
when "vban"
|
||||||
dir = "#{index.chomp("stream")}stream"
|
dir = "#{index.chomp("stream")}stream"
|
||||||
index = rem[0]
|
index = rem[0]
|
||||||
target = vban.send(dir)
|
target = vban.send(dir)
|
||||||
|
else
|
||||||
|
raise KeyError, "invalid config key '#{kls}'"
|
||||||
end
|
end
|
||||||
target[index.to_i].apply(val)
|
target[index.to_i].apply(val)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user