Class: TCB::EventBus::RunningStrategy
- Inherits:
-
Object
- Object
- TCB::EventBus::RunningStrategy
- Defined in:
- lib/tcb/event_bus/running_strategy.rb
Instance Method Summary collapse
-
#initialize(event_bus) ⇒ RunningStrategy
constructor
A new instance of RunningStrategy.
- #publish(event) ⇒ Object
- #shutdown? ⇒ Boolean
- #subscribe(event_class, &block) ⇒ Object
Constructor Details
#initialize(event_bus) ⇒ RunningStrategy
Returns a new instance of RunningStrategy.
6 7 8 |
# File 'lib/tcb/event_bus/running_strategy.rb', line 6 def initialize(event_bus) @event_bus = event_bus end |
Instance Method Details
#publish(event) ⇒ Object
10 11 12 13 |
# File 'lib/tcb/event_bus/running_strategy.rb', line 10 def publish(event) @event_bus.queue << event event end |
#shutdown? ⇒ Boolean
19 20 21 |
# File 'lib/tcb/event_bus/running_strategy.rb', line 19 def shutdown? false end |
#subscribe(event_class, &block) ⇒ Object
15 16 17 |
# File 'lib/tcb/event_bus/running_strategy.rb', line 15 def subscribe(event_class, &block) @event_bus.registry.add(event_class, block) end |