Class: RubySlime::EventRouter
- Inherits:
-
Object
- Object
- RubySlime::EventRouter
- Includes:
- Internals::EventMetadataHandler
- Defined in:
- lib/ruby_slime/event_router.rb
Instance Method Summary collapse
- #call(event, **metadata) ⇒ Object
-
#initialize(handlers_map = {}) ⇒ EventRouter
constructor
A new instance of EventRouter.
Constructor Details
#initialize(handlers_map = {}) ⇒ EventRouter
Returns a new instance of EventRouter.
7 8 9 10 |
# File 'lib/ruby_slime/event_router.rb', line 7 def initialize(handlers_map = {}) @handlers_map = handlers_map freeze end |
Instance Method Details
#call(event, **metadata) ⇒ Object
12 13 14 15 16 |
# File 'lib/ruby_slime/event_router.rb', line 12 def call(event, **) handler = @handlers_map[event.class] return unless handler handle_handler_arguments(handler, event, ) end |