lib/reactor/event.rb in reactor-0.5.1 vs lib/reactor/event.rb in reactor-0.5.2
- old
+ new
@@ -20,21 +20,10 @@
#TODO: support more matching?
Reactor::Subscriber.where(event: '*').each do |s|
Reactor::Subscriber.delay.fire s.id, data
end
- static_subscribers = (Reactor::SUBSCRIBERS[name.to_s] || []) | (Reactor::SUBSCRIBERS['*'] || [])
- if static_subscribers.any?
- static_subscribers.each do |callback|
- delay = callback[:options].try(:[], :delay) || 0
- case method = callback[:method]
- when Symbol
- callback[:source].delay_for(delay).send method, Reactor::Event.new(data)
- else
- method.call Reactor::Event.new(data)
- end
- end
- end
+ ((Reactor::SUBSCRIBERS[name.to_s] || []) | (Reactor::SUBSCRIBERS['*'] || [])).each {|s| s.perform_async(data) }
end
def method_missing(method, *args)
if method.to_s.include?('=')
try_setter(method, *args)