mirror of
https://github.com/onyx-and-iris/obsws-ruby.git
synced 2025-01-18 05:20:47 +00:00
remove_observers now accepts array of callbacks
callbacks aliases observers patch bump
This commit is contained in:
parent
aeec0635ca
commit
f669498c69
@ -47,10 +47,11 @@ module OBSWS
|
||||
end
|
||||
|
||||
def remove_observer(observer)
|
||||
observers.delete(observer)
|
||||
observer = [observer] unless observer.respond_to? :each
|
||||
observers.reject! { |o| observer.include? o }
|
||||
end
|
||||
|
||||
def notify_observers(event, data)
|
||||
private def notify_observers(event, data)
|
||||
observers.each do |o|
|
||||
if o.is_a? Method
|
||||
if o.name.to_s == "on_#{snakecase(event)}"
|
||||
@ -62,6 +63,7 @@ module OBSWS
|
||||
end
|
||||
end
|
||||
|
||||
alias_method :callbacks, :observers
|
||||
alias_method :register, :add_observer
|
||||
alias_method :deregister, :remove_observer
|
||||
end
|
||||
|
@ -11,7 +11,7 @@ module OBSWS
|
||||
end
|
||||
|
||||
def patch
|
||||
0
|
||||
1
|
||||
end
|
||||
|
||||
def to_a
|
||||
|
Loading…
Reference in New Issue
Block a user