Mustermann::Expander#expand

Parsed documentation:
View on GitHub
@example Expanding a pattern
  pattern = Mustermann::Expander.new('/:name', '/:name.:ext')
  pattern.expand(name: 'hello')             # => "/hello"
  pattern.expand(name: 'hello', ext: 'png') # => "/hello.png"

@example Handling additional values
  pattern = Mustermann::Expander.new('/:name', '/:name.:ext')
  pattern.expand(:ignore, name: 'hello', ext: 'png', scale: '2x') # => "/hello.png"
  pattern.expand(:append, name: 'hello', ext: 'png', scale: '2x') # => "/hello.png?scale=2x"
  pattern.expand(:raise,  name: 'hello', ext: 'png', scale: '2x') # raises Mustermann::ExpandError

@example Setting additional values behavior for the expander object
  pattern = Mustermann::Expander.new('/:name', '/:name.:ext', additional_values: :append)
  pattern.expand(name: 'hello', ext: 'png', scale: '2x') # => "/hello.png?scale=2x"

@param [Symbol] behavior
  What to do with additional key/value pairs not present in the values hash.
  Possible options: :raise, :ignore, :append.

@param [Hash{Symbol: #to_s, Array<#to_s>}] values
  Values to use for expansion.

@return [String] expanded string
@raise [NotImplementedError] raised if expand is not supported.
@raise [Mustermann::ExpandError] raised if a value is missing or unknown
Suggestions:
Please help! Open an issue on GitHub if this assessment is incorrect.