Namespace
- MODULE ActionDispatch::Routing::Mapper::Base
- MODULE ActionDispatch::Routing::Mapper::Concerns
- MODULE ActionDispatch::Routing::Mapper::CustomUrls
- MODULE ActionDispatch::Routing::Mapper::HttpHelpers
- MODULE ActionDispatch::Routing::Mapper::Resources
- MODULE ActionDispatch::Routing::Mapper::Scoping
Methods
Included Modules
- ActionDispatch::Routing::Mapper::Base
- ActionDispatch::Routing::Mapper::HttpHelpers
- ActionDispatch::Routing::Redirection
- ActionDispatch::Routing::Mapper::Scoping
- ActionDispatch::Routing::Mapper::Concerns
- ActionDispatch::Routing::Mapper::Resources
- ActionDispatch::Routing::Mapper::CustomUrls
Constants
URL_OPTIONS | = | [:protocol, :subdomain, :domain, :host, :port] |
Class Public methods
normalize_name(name) Link
normalize_path(path) Link
Invokes Journey::Router::Utils.normalize_path, then ensures that /(:locale) becomes (/:locale). Except for root cases, where the former is the correct one.
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 375 def self.normalize_path(path) path = Journey::Router::Utils.normalize_path(path) # the path for a root URL at this point can be something like # "/(/:locale)(/:platform)/(:browser)", and we would want # "/(:locale)(/:platform)(/:browser)" # reverse "/(", "/((" etc to "(/", "((/" etc path.gsub!(%r{/(\(+)/?}, '\1/') # if a path is all optional segments, change the leading "(/" back to # "/(" so it evaluates to "/" when interpreted with no options. # Unless, however, at least one secondary segment consists of a static # part, ex. "(/:locale)(/pages/:page)" path.sub!(%r{^(\(+)/}, '/\1') if %r{^(\(+[^)]+\))(\(+/:[^)]+\))*$}.match?(path) path end