Class: Del::DefaultRouter
- Inherits:
-
Object
- Object
- Del::DefaultRouter
- Defined in:
- lib/del/default_router.rb
Overview
This class is the default router used to route chat messages to chat routes.
Instance Method Summary collapse
-
#initialize(routes = []) ⇒ DefaultRouter
constructor
A new instance of DefaultRouter.
- #register(pattern, &block) ⇒ Object
- #route(message) ⇒ Object
Constructor Details
#initialize(routes = []) ⇒ DefaultRouter
Returns a new instance of DefaultRouter.
7 8 9 |
# File 'lib/del/default_router.rb', line 7 def initialize(routes = []) @routes = routes end |
Instance Method Details
#register(pattern, &block) ⇒ Object
11 12 13 |
# File 'lib/del/default_router.rb', line 11 def register(pattern, &block) @routes.push(pattern: pattern, command: block) end |