Module: Roda::RodaPlugins::PlaceholderStringMatchers

Defined in:
lib/roda/plugins/placeholder_string_matchers.rb

Overview

The placeholder_string_matcher plugin exists for backwards compatibility with previous versions of Roda that allowed placeholders inside strings if they were prefixed by colons:

plugin :placeholder_string_matchers

route do |r|
  r.is("foo/:bar") |v|
    # matches foo/baz, yielding "baz"
    # does not match foo, foo/, or foo/baz/
  end
end

It is not recommended to use this in new applications, and it is encouraged to use separate string class or symbol matchers instead:

r.is "foo", String
r.is "foo", :bar

If used with the symbol_matchers plugin, this plugin respects the regexps for the registered symbols, but it does not perform the conversions, the captures for the regexp are used directly as the captures for the match method.

Defined Under Namespace

Modules: RequestMethods

Class Method Summary collapse

Class Method Details

.load_dependencies(app) ⇒ Object



29
30
31
# File 'lib/roda/plugins/placeholder_string_matchers.rb', line 29

def self.load_dependencies(app)
  app.plugin :_symbol_regexp_matchers
end