Skip to content
This repository was archived by the owner on Oct 27, 2026. It is now read-only.
ruby-grapePublic archive

About

Implements the grape pattern type for Mustermann.

Resources

Stars

8 stars

Watchers

4 watching

Forks

Repository files navigation

Grape Syntax for Mustermann

This gem implements the grape pattern type for Mustermann.

Retirement notice

This adapter is retired; no further development is planned in this repository. Starting with Grape 3.3.0, released June 20, 2026, Grape maintains its path-pattern grammar internally as Grape::Router::MustermannPattern and depends on mustermann directly instead of mustermann-grape (grape#2755). Current Grape applications do not need this adapter; normal Grape routing requires no migration.

Existing RubyGems releases remain available for older Grape versions that depend on this gem and for applications using the adapter directly. Retiring this repository does not remove those releases.

If your application calls Mustermann.new(pattern, type: :grape), keep an explicit gem 'mustermann-grape' dependency and require 'mustermann/grape'. Grape's internal pattern class does not register type: :grape and is not a public replacement for that standalone API. Report routing issues affecting current Grape in the Grape repository.

tests

Overview

Supported options: capture, converters, except, greedy, ignore_unknown_options, params, space_matches_plus and uri_decode

require 'mustermann/grape'

Mustermann.new('/:id', type: :grape).params('/foo') # => { id: 'foo' }

# Providing params option
Mustermann.new('/:id', type: :grape, params: {"id"=>{:type=>"Integer"}}).params('/1') # => { id: '1'}
Mustermann.new('/:id', type: :grape, params: {"id"=>{:type=>"Integer"}}).params('/foo') # => nil
Mustermann.new('/:id', type: :grape, params: {"id"=>{:type=>"String"}}).params('/foo') # => { id: 'foo'}

Syntax

Syntax Element Description
:name or {name} Captures anything but a forward slash in a semi-greedy fashion. Capture is named name. Capture behavior can be modified with capture and greedy option.
*name or {+name} Captures anything in a non-greedy fashion. Capture is named name.
* or {+splat} Captures anything in a non-greedy fashion. Capture is named splat. It is always an array of captures, as you can use it more than once in a pattern.
(expression) Enclosed expression is optional.
expression|expression|... Will match anything matching the nested expressions. May contain any other syntax element, including captures.
x? Makes x optional. For instance, (foo)? matches foo or an empty string.
/ Matches forward slash. Does not match URI encoded version of forward slash.
\x Matches x or URI encoded version of x. For instance \* matches *.
any other character Matches exactly that character or a URI encoded version of it.

About

Implements the grape pattern type for Mustermann.

Resources

Stars

8 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages