class Mustermann::Template
URI template pattern implementation.
@example
Mustermann.new('/{foo}') === '/bar' # => true
@see Mustermann::Pattern @see file:README.md#template Syntax description in the README @see tools.ietf.org/html/rfc6570 RFC 6570
Public Instance Methods
to_templates()
click to toggle source
Identity patterns support generating templates (the logic is quite complex, though).
@example (see Mustermann::Pattern#to_templates) @param (see Mustermann::Pattern#to_templates) @return (see Mustermann::Pattern#to_templates) @see Mustermann::Pattern#to_templates
# File lib/mustermann/template.rb, line 57 def to_templates [to_s] end
Private Instance Methods
always_array?(key)
click to toggle source
@!visibility private
# File lib/mustermann/template.rb, line 47 def always_array?(key) @split_params.include? key end
compile(*args, **options)
click to toggle source
@!visibility private
Calls superclass method
# File lib/mustermann/template.rb, line 33 def compile(*args, **options) @split_params = {} super(*args, split_params: @split_params, **options) end
map_param(key, value)
click to toggle source
@!visibility private
Calls superclass method
# File lib/mustermann/template.rb, line 39 def map_param(key, value) return super unless variable = @split_params[key] value = value.split variable[:separator] value.map! { |e| e.sub(/\A#{key}=/, '') } if variable[:parametric] value.map! { |e| super(key, e) } end