class URITemplate::Template

Defined in:

uri_template/template.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(uri : String) #

[View source]

Class Method Detail

def self.parse(str : String) : Array(String | URIVariable) #

Parse the template, looking for bracketed expressions. In a quick survey of other implementations, many seem to use Regex's to parse the template, however it's hard to pinpoint errors in the input template using Regex ("do or do not, there is no try").


[View source]

Instance Method Detail

def ==(other) : Bool #

Check equality by comparing the URI field.


[View source]
def expand(var_hash : VariableValueHash | Nil = nil, **kwargs) : String #

Expand the URI with the +var_hash+, keyword arguments a mix of the two. Complete expansions return a String.


[View source]
def expand_partial(var_hash : VariableValueHash | Nil = nil, **kwargs) : Template #

Partial expansions should return another Template object.


[View source]
def to_s : String #

The original URI String.


[View source]
def uri : String #

Gets the original URI string used to construct the Template object


[View source]
def variable_names : Set(String) #

A set of unique variable names in this template


[View source]
def variables #

Retrieves the Components that are URIVariables


[View source]