class
ActionController::MCPServer::URITemplate
- ActionController::MCPServer::URITemplate
- Reference
- Object
Overview
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"}
Defined in:
action-controller/mcp/uri_template.crConstructors
Instance Method Summary
-
#match(uri : String) : Hash(String, String) | Nil
the variables of a matching URI, percent decoded, otherwise
nil. -
#path_variables : Array(String)
the variables in the path, in order
-
#query_variables : Array(String)
the variables of the query expansion
-
#specificity : Tuple(Int32, Int32)
sorts templates so the most specific are matched first: those with fewer variables, then longer literals
- #template : String
Constructor Detail
Instance Method Detail
def 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
def specificity : Tuple(Int32, Int32)
#
sorts templates so the most specific are matched first: those with fewer variables, then longer literals