Class: Mustermann::Hybrid
- Inherits:
-
Sinatra
- Object
- Pattern
- RegexpBased
- AST::Pattern
- Sinatra
- Mustermann::Hybrid
- Defined in:
- lib/mustermann/hybrid.rb
Overview
Hybrid pattern type that bridges Sinatra and Rails pattern syntax.
It supports all syntax elements of Sinatra, plus URI template-style placeholders, and changes the semantics of parenthesized groups to match Rails:
-
A group without a pipe operator is **implicitly optional**, even without a trailing ‘?`. So `/foo(/bar)` matches both `/foo/bar` and `/foo`.
-
A group with a pipe operator is not implicitly optional, to avoid the ambiguity of ‘/scope/(a|b)` also matching `/scope/`. Add a trailing `?` to make such a group optional explicitly: `/scope/(a|b)?`.
Constant Summary
Constants included from Mustermann
CompileError, DEFAULT_TYPE, Error, ExpandError, ParseError, TrieError
Instance Attribute Summary
Attributes inherited from RegexpBased
Attributes inherited from Pattern
Method Summary
Methods inherited from Sinatra
Methods inherited from AST::Pattern
Methods inherited from RegexpBased
#initialize, #match, #peek_match, #peek_size
Methods inherited from Pattern
#+, #==, #===, #=~, #eql?, #expand, #hash, #initialize, #match, new, #params, #peek, #peek_match, #peek_params, #peek_size, supported?, supported_options, #to_proc, #to_s, #to_templates, #|
Methods included from Mustermann
Constructor Details
This class inherits a constructor from Mustermann::RegexpBased