module Roda::RodaPlugins::MultiRoute::RequestClassMethods

  1. lib/roda/plugins/multi_route.rb

Public Instance methods

clear_named_route_regexp!(namespace=nil)

Clear cached regexp for named routes, it will be regenerated the next time it is needed.

This shouldn’t be an issue in production applications, but during development it’s useful to support new named routes being added while the application is running.

[show source]
    # File lib/roda/plugins/multi_route.rb
126 def clear_named_route_regexp!(namespace=nil)
127   @namespaced_route_regexps.delete(namespace)
128 end
named_route_regexp(namespace=nil)

A regexp matching any of the current named routes.

[show source]
    # File lib/roda/plugins/multi_route.rb
131 def named_route_regexp(namespace=nil)
132   @namespaced_route_regexps[namespace] ||= /(#{Regexp.union(roda_class.named_routes(namespace).select{|s| s.is_a?(String)}.sort.reverse)})/
133 end