Class: ActionDispatch::Routing::Mapper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::Mapper
- Includes:
- Base, Concerns, CustomUrls, HttpHelpers, Resources, Scoping, Redirection
- Defined in:
- lib/action_dispatch/routing/mapper.rb
Defined Under Namespace
Modules: Base, Concerns, CustomUrls, HttpHelpers, Resources, Scoping Classes: Constraints, Mapping, Scope
Constant Summary collapse
- URL_OPTIONS =
[:protocol, :subdomain, :domain, :host, :port]
Constants included from Resources
Resources::CANONICAL_ACTIONS, Resources::RESOURCE_OPTIONS, Resources::VALID_ON_OPTIONS
Constants included from Scoping
Class Method Summary collapse
- .normalize_name(name) ⇒ Object
-
.normalize_path(path) ⇒ Object
Invokes Journey::Router::Utils.normalize_path and ensure that (:locale) becomes (/:locale) instead of /(:locale).
Instance Method Summary collapse
-
#initialize(set) ⇒ Mapper
constructor
:nodoc:.
Methods included from CustomUrls
Methods included from Resources
#collection, #match, #member, #namespace, #nested, #new, #resource, #resources, #resources_path_names, #root, #shallow, #shallow?
Methods included from Concerns
Methods included from Scoping
#constraints, #controller, #defaults, #namespace, #scope
Methods included from Redirection
Methods included from HttpHelpers
#delete, #get, #patch, #post, #put
Methods included from Base
#default_url_options=, #has_named_route?, #match, #mount, #with_default_scope
Constructor Details
Class Method Details
.normalize_name(name) ⇒ Object
405 406 407 |
# File 'lib/action_dispatch/routing/mapper.rb', line 405 def self.normalize_name(name) normalize_path(name)[1..-1].tr("/", "_") end |
.normalize_path(path) ⇒ Object
Invokes Journey::Router::Utils.normalize_path and ensure that (:locale) becomes (/:locale) instead of /(:locale). Except for root cases, where the latter is the correct one.
399 400 401 402 403 |
# File 'lib/action_dispatch/routing/mapper.rb', line 399 def self.normalize_path(path) path = Journey::Router::Utils.normalize_path(path) path.gsub!(%r{/(\(+)/?}, '\1/') unless %r{^/(\(+[^)]+\)){1,}$}.match?(path) path end |