we already know valid params

so we can set instance variabels dynamically
This commit is contained in:
onyx-and-iris 2023-07-27 21:54:53 +01:00
parent 54e255535f
commit 23ac1b670c
2 changed files with 5 additions and 6 deletions

View File

@ -609,7 +609,7 @@ p vm.event.get
### Remote class
#### Voicemeeter.remote
#### Voicemeeter::Remote
You may pass the following optional keyword arguments:

View File

@ -31,13 +31,12 @@ module Voicemeeter
attr_reader :pdirty, :mdirty, :midi, :ldirty
def initialize(pdirty: false, mdirty: false, midi: false, ldirty: false)
def initialize(**kwargs)
make_writer_methods :pdirty, :mdirty, :midi, :ldirty
self.pdirty = pdirty
self.mdirty = mdirty
self.midi = midi
self.ldirty = ldirty
kwargs.each do |key, value|
instance_variable_set("@#{key}", value || false)
end
end
def to_s