Class: Eventsimple::EventDispatcher
- Inherits:
-
Object
- Object
- Eventsimple::EventDispatcher
- Defined in:
- lib/eventsimple/event_dispatcher.rb
Defined Under Namespace
Classes: ReactorSet, RuleSet
Class Method Summary collapse
-
.dispatch(event) ⇒ Object
Dispatches events to matching Reactors once.
- .rules ⇒ Object
Class Method Details
.dispatch(event) ⇒ Object
Dispatches events to matching Reactors once. Called by all events after they are created.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/eventsimple/event_dispatcher.rb', line 29 def self.dispatch(event) reactors = rules.for(event) reactors.sync.each do |reactor| reactor.perform_now(event) event.reload end reactors.async.each do |reactor| reactor.perform_later(event) end end |