make_writer_methods added to Event class

This commit is contained in:
onyx-and-iris 2023-07-25 10:37:35 +01:00
parent 53f2c1847f
commit 8b45ffbeb6

View File

@ -36,6 +36,7 @@ module Voicemeeter
@mdirty = mdirty @mdirty = mdirty
@midi = midi @midi = midi
@ldirty = ldirty @ldirty = ldirty
make_writer_methods :pdirty, :mdirty, :midi, :ldirty
end end
def to_s def to_s
@ -52,24 +53,13 @@ module Voicemeeter
logger.info(info_msg.join(" ")) logger.info(info_msg.join(" "))
end end
def pdirty=(val) def make_writer_methods(*params)
@pdirty = val params.each do |param|
info("pdirty #{val ? "added to" : "removed from"}") define_singleton_method("#{param}=") do |value|
end instance_variable_set("@#{param}", value)
info("#{param} #{send(param) ? "added to" : "removed from"}")
def mdirty=(val) end
@mdirty = val end
info("mdirty #{val ? "added to" : "removed from"}")
end
def ldirty=(val)
@ldirty = val
info("ldirty #{val ? "added to" : "removed from"}")
end
def midi=(val)
@midi = val
info("midi #{val ? "added to" : "removed from"}")
end end
def get def get