use Kernel#Array

This commit is contained in:
onyx-and-iris 2023-08-29 15:45:23 +01:00
parent 587e861bbe
commit 7cf05fbe08

View File

@ -40,12 +40,12 @@ module OBSWS
end
def register(cbs)
cbs = [cbs] unless cbs.respond_to? :each
cbs = Array(cbs) unless cbs.respond_to? :each
cbs.each { |cb| on(cb.name[3..].to_sym, cb) }
end
def deregister(cbs)
cbs = [cbs] unless cbs.respond_to? :each
cbs = Array(cbs) unless cbs.respond_to? :each
cbs.each { |cb| observers[cb.name[3..].to_sym]&.reject! { |o| cbs.include? o } }
end