Class: SuperPoller::Router
- Inherits:
-
Object
- Object
- SuperPoller::Router
- Defined in:
- lib/super_poller/router.rb
Constant Summary collapse
- RoutingError =
Class.new(Exception)
Instance Method Summary collapse
- #add_handler(handler) ⇒ Object (also: #<<)
- #call(message) ⇒ Object
-
#initialize ⇒ Router
constructor
A new instance of Router.
Constructor Details
#initialize ⇒ Router
Returns a new instance of Router.
4 5 6 |
# File 'lib/super_poller/router.rb', line 4 def initialize() @handlers = [] end |
Instance Method Details
#add_handler(handler) ⇒ Object Also known as: <<
8 9 10 11 12 |
# File 'lib/super_poller/router.rb', line 8 def add_handler(handler) @handlers.push handler @handlers.uniq! self end |
#call(message) ⇒ Object
16 17 18 19 |
# File 'lib/super_poller/router.rb', line 16 def call() handler = () handler.call([:body]) end |