Method: ActionDispatch::Routing::Mapper.normalize_path
- Defined in:
- lib/action_dispatch/routing/mapper.rb
.normalize_path(path) ⇒ Object
Invokes Rack::Mount::Utils.normalize path and ensure that (:locale) becomes (/:locale) instead of /(:locale). Except for root cases, where the latter is the correct one.
234 235 236 237 238 |
# File 'lib/action_dispatch/routing/mapper.rb', line 234 def self.normalize_path(path) path = Rack::Mount::Utils.normalize_path(path) path.gsub!(%r{/(\(+)/?}, '\1/') unless path =~ %r{^/\(+[^/]+\)$} path end |