Method: Jets::Router::Matcher#match?
- Defined in:
- lib/jets/router/matcher.rb
#match?(route) ⇒ Boolean
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jets/router/matcher.rb', line 8 def match?(route) # Immediately stop checking when the request method: GET, POST, ANY, etc # doesnt match. return false if method != route.method && route.method != "ANY" route_path = route.path if path == route_path # regular string match detection return true # exact route matches are highest precedence end # Check path for route capture and wildcard matches: # A colon (:) means the variable has a variable if route_path.include?(':') # 2nd highest precedence capture_detection(route_path, path) # early return true or false # A star (*) means the variable has a glob elsif route_path.include?('*') # lowest precedence proxy_detection(route_path, path) # early return true or false else false # reach here, means no route matched end end |