Mustermann::Pattern#expand

Parsed documentation:
View on GitHub
@note This method is only implemented by certain subclasses.

@example Expanding a pattern
  pattern = Mustermann.new('/:name(.:ext)?')
  pattern.expand(name: 'hello')             # => "/hello"
  pattern.expand(name: 'hello', ext: 'png') # => "/hello.png"

@example Checking if a pattern supports expanding
  if pattern.respond_to? :expand
    pattern.expand(name: "foo")
  else
    warn "does not support expanding"
  end

Expanding is supported by almost all patterns (notable execptions are {Mustermann::Shell},
{Mustermann::Regular} and {Mustermann::Simple}).

Union {Mustermann::Composite} patterns (with the | operator) support expanding if all
patterns they are composed of also support it.

@param (see Mustermann::Expander#expand)
@return [String] expanded string
@raise [NotImplementedError] raised if expand is not supported.
@raise [Mustermann::ExpandError] raised if a value is missing or unknown
@see Mustermann::Expander
No suggestions.
Please help! Open an issue on GitHub if this assessment is incorrect.