Class: EventBus::Listener
- Inherits:
-
Object
- Object
- EventBus::Listener
- Defined in:
- lib/event_bus/listener.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.on(event_name, &block) ⇒ Object
5 6 7 |
# File 'lib/event_bus/listener.rb', line 5 def self.on(event_name, &block) new.on(event_name, &block) end |
Instance Method Details
#on(event_name, &block) ⇒ Object
9 10 11 12 13 |
# File 'lib/event_bus/listener.rb', line 9 def on(event_name, &block) raise MissingAttributeError.new('Event name must be present') unless event_name && event_name.size > 0 EventBus::Config.broker.consume(event_name, &block) end |