Class: Hanami::Router::GlobbedPath
- Inherits:
-
Object
- Object
- Hanami::Router::GlobbedPath
- Defined in:
- lib/hanami/router/globbed_path.rb
Overview
Instance Method Summary collapse
- #endpoint_and_params(env) ⇒ Object
-
#initialize(http_method, path, to) ⇒ GlobbedPath
constructor
A new instance of GlobbedPath.
Constructor Details
#initialize(http_method, path, to) ⇒ GlobbedPath
Returns a new instance of GlobbedPath.
6 7 8 9 10 |
# File 'lib/hanami/router/globbed_path.rb', line 6 def initialize(http_method, path, to) @http_method = http_method @path = path @to = to end |
Instance Method Details
#endpoint_and_params(env) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/hanami/router/globbed_path.rb', line 12 def endpoint_and_params(env) return [] unless @http_method == env[::Rack::REQUEST_METHOD] if (match = @path.match(env[::Rack::PATH_INFO])) [@to, match.named_captures] else [] end end |