mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-21 17:30: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)
|
||||
data.each do |key, val|
|
||||
kls, index, *rem = key.to_s.split("-")
|
||||
if rem.empty?
|
||||
case kls
|
||||
when "strip", "bus", "button"
|
||||
target = send(kls)
|
||||
else
|
||||
when "vban"
|
||||
dir = "#{index.chomp("stream")}stream"
|
||||
index = rem[0]
|
||||
target = vban.send(dir)
|
||||
else
|
||||
raise KeyError, "invalid config key '#{kls}'"
|
||||
end
|
||||
target[index.to_i].apply(val)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user