class

ActionController::MCPServer::URITemplate

Inherits Reference < Object

the subset of RFC 6570 URI templates used by resource templates: simple {name} expansions, which never span a /, and a trailing form style query {?name,other}

template = URITemplate.new("app://widgets/{id}/logs{?seconds}")
template.match("app://widgets/12/logs?seconds=30") # => {"id" => "12", "seconds" => "30"}

Constructors

new(template : String)
Source

Instance methods

match(uri : String) : Hash(String, String) | Nil

the variables of a matching URI, percent decoded, otherwise nil. Query params that aren't template variables don't match

Source
path_variables

the variables in the path, in order

Source
query_variables

the variables of the query expansion

Source
specificity

sorts templates so the most specific are matched first: those with fewer variables, then longer literals

Source
template
Source

Nested types