Skip to content

sinatra/mustermann

The Amazing Mustermann

Build Status Coverage Status Gem Version Inline docs Documentation License Badges

This repository contains two projects (each installable as separate gems):

  • mustermann: Your personal string matching expert. This is probably what you're looking for.
  • mustermann-contrib: A gem with additional pattern types and extensions.

Git versions with Bundler

You can easily use the latest edge version from GitHub of any of these gems via Bundler:

github 'sinatra/mustermann' do
  gem 'mustermann'
  gem 'mustermann-contrib'
end

Pattern Types

The identity, regexp, rails, and sinatra types are included in the mustermann gem, all the other types listed here are part of the mustermann-contrib gem. There are also third-party gems providing additional types, like mustermann-grape.

Type Example Compatible with Notes
cake /:prefix/** CakePHP
express /:prefix+/:id(\d+) Express, pillar.js
flask /<prefix>/<int:id> Flask, Werkzeug
identity /image.png any software using strings Exact string matching (no parameter parsing).
pyramid /{prefix:.*}/{id} Pyramid, Pylons
rails /:slug(.:ext) Ruby on Rails, Journey, HTTP Router, Hanami, Scalatra (if configured), NYNY
regexp /(?<slug>[^\/]+) Oniguruma, Onigmo, regular expressions Created when you pass a regexp to Mustermann.new.
Does not support expanding or generating templates.
shell /*.{png,jpg} Unix Shell (bash, zsh) Does not support expanding or generating templates.
simple /:slug.:ext Sinatra (1.x), Scalatra, Dancer, Finatra, Spark, RCRouter, kick.js Implementation is a direct copy from Sinatra 1.3.
It is the predecessor of sinatra. Does not support expanding or generating templates.
sinatra /:slug(.:ext)? Sinatra (2.x), Padrino (>= 0.13.0), Pendragon, Angelo This is the default and the only type "invented here".
It is a superset of simple and has a common subset with template (and others).
uri-template /{+pre}/{page}{?q} RFC 6570, JSON API, JSON Home Documents and many more Standardized URI templates, can be generated from most other types.

Any software using Mustermann is obviously compatible with at least one of the above.

Requirements

Ruby 3.3+ compatible Ruby implementation (MRI, JRuby, and TruffleRuby are tested).

About

your personal string matching expert

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors

Languages