Class: Holoserve::Request::Router
- Inherits:
-
Object
- Object
- Holoserve::Request::Router
- Defined in:
- lib/holoserve/request/router.rb
Instance Method Summary collapse
- #dispatch(environment) ⇒ Object
-
#initialize(routes) ⇒ Router
constructor
A new instance of Router.
Constructor Details
#initialize(routes) ⇒ Router
Returns a new instance of Router.
4 5 6 7 |
# File 'lib/holoserve/request/router.rb', line 4 def initialize(routes) @routes = routes substitute_paths end |
Instance Method Details
#dispatch(environment) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/holoserve/request/router.rb', line 9 def dispatch(environment) route = find_route environment["REQUEST_METHOD"].downcase.to_sym, environment["PATH_INFO"] if route if @parameters environment["parameters"] ||= { } environment["parameters"].merge! @parameters end route[:handler].response environment else nil end end |