Module: Mustermann
- Included in:
- Pattern
- Defined in:
- lib/mustermann.rb,
lib/mustermann/error.rb,
lib/mustermann/rails.rb,
lib/mustermann/shell.rb,
lib/mustermann/caster.rb,
lib/mustermann/mapper.rb,
lib/mustermann/router.rb,
lib/mustermann/simple.rb,
lib/mustermann/pattern.rb,
lib/mustermann/regular.rb,
lib/mustermann/sinatra.rb,
lib/mustermann/version.rb,
lib/mustermann/ast/node.rb,
lib/mustermann/expander.rb,
lib/mustermann/identity.rb,
lib/mustermann/template.rb,
lib/mustermann/extension.rb,
lib/mustermann/ast/parser.rb,
lib/mustermann/to_pattern.rb,
lib/mustermann/ast/pattern.rb,
lib/mustermann/router/rack.rb,
lib/mustermann/ast/compiler.rb,
lib/mustermann/ast/expander.rb,
lib/mustermann/regexp_based.rb,
lib/mustermann/simple_match.rb,
lib/mustermann/router/simple.rb,
lib/mustermann/ast/translator.rb,
lib/mustermann/ast/validation.rb,
lib/mustermann/ast/transformer.rb,
lib/mustermann/ast/tree_renderer.rb
Overview
Namespace and main entry point for the Mustermann library.
Under normal circumstances the only external API entry point you should be using is Mustermann.new.
Defined Under Namespace
Modules: AST, Extension, Router, ToPattern Classes: Expander, Identity, Mapper, Pattern, Rails, RegexpBased, Regular, Shell, Simple, SimpleMatch, Sinatra, Template
Class Method Summary collapse
-
.[](key) ⇒ Class, #new
Maps a type to its factory.
-
.new(input, type: :sinatra, **options) ⇒ Mustermann::Pattern
Pattern corresponding to string.
Class Method Details
.[](key) ⇒ Class, #new
Maps a type to its factory.
30 31 32 33 34 |
# File 'lib/mustermann.rb', line 30 def self.[](key) constant, library = register.fetch(key) { raise ArgumentError, "unsupported type %p" % key } require library if library constant.respond_to?(:new) ? constant : register[key] = const_get(constant) end |
.new(input, type: :sinatra, **options) ⇒ Mustermann::Pattern
Returns pattern corresponding to string.
13 14 15 16 17 18 19 20 |
# File 'lib/mustermann.rb', line 13 def self.new(input, type: :sinatra, **) case input when Pattern then input when Regexp then self[:regexp].new(input, **) when String then self[type].new(input, **) else input.to_pattern(type: type, **) end end |