class ActionController::MCPServer::URITemplate

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.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(template : String) #

[View source]

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


[View source]
def path_variables : Array(String) #

the variables in the path, in order


[View source]
def query_variables : Array(String) #

the variables of the query expansion


[View source]
def specificity : Tuple(Int32, Int32) #

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


[View source]
def template : String #

[View source]