class

LuckyRouter::Matcher(T)

Inherits Reference < Object

Add routes and match routes

'T' is the type of the 'payload'. The 'payload' is what will be returned if the route matches.

Example

# 'T' will be 'Symbol'
router = LuckyRouter::Matcher(Symbol).new

# Tell the router what payload to return if matched
router.add("get", "/users", :index)

# This will return :index
router.match("get", "/users").payload # :index

Instance methods

add(method : String, path : String, payload : T)
Source
list_routes

Array of the path, method, and payload

Source
match(method : String, path_to_match : String) : Match(T) | Nil
Source
match!(method : String, path_to_match : String) : Match(T)
Source
normalized_paths
Source
root

starting point from which all fragments are located

Source