命名空間
- 模組 ActionDispatch::Routing::Mapper::Base
- 模組 ActionDispatch::Routing::Mapper::Concerns
- 模組 ActionDispatch::Routing::Mapper::CustomUrls
- 模組 ActionDispatch::Routing::Mapper::HttpHelpers
- 模組 ActionDispatch::Routing::Mapper::Resources
- 模組 ActionDispatch::Routing::Mapper::Scoping
方法
包含的模組
- 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
常數
URL_OPTIONS | = | [:protocol, :subdomain, :domain, :host, :port] |
類別公開方法
normalize_name(name) 連結
normalize_path(path) 連結
呼叫 Journey::Router::Utils.normalize_path,然後確保 /(:locale) 變成 (/:locale)。但根路徑的狀況除外,根路徑的狀況下前者才是正確的。
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 397 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