Class: ActionDispatch::Routing::Mapper
- Includes:
- Base, HttpHelpers, Resources, Scoping, Redirection
- Defined in:
- actionpack/lib/action_dispatch/routing/mapper.rb
Defined Under Namespace
Modules: Base, HttpHelpers, Resources, Scoping Classes: Constraints, Mapping
Constant Summary
Constants included from Resources
Resources::CANONICAL_ACTIONS, Resources::RESOURCE_OPTIONS, Resources::VALID_ON_OPTIONS
Class Method Summary collapse
- .normalize_name(name) ⇒ Object
-
.normalize_path(path) ⇒ Object
Invokes Rack::Mount::Utils.normalize path and ensure that (:locale) becomes (/:locale) instead of /(:locale).
Instance Method Summary collapse
-
#initialize(set) ⇒ Mapper
constructor
:nodoc:.
Methods included from Resources
#add_route, #collection, #decomposed_match, #match, #member, #namespace, #nested, #new, #resource, #resources, #resources_path_names, #root, #shallow, #shallow?
Methods included from Scoping
#constraints, #controller, #defaults, #namespace, #scope
Methods included from Redirection
Methods included from HttpHelpers
Methods included from Base
#default_url_options=, #match, #mount, #root, #with_default_scope
Constructor Details
#initialize(set) ⇒ Mapper
:nodoc:
1497 1498 1499 1500 |
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1497 def initialize(set) #:nodoc: @set = set @scope = { :path_names => @set.resources_path_names } end |
Class Method Details
.normalize_name(name) ⇒ Object
245 246 247 |
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 245 def self.normalize_name(name) normalize_path(name)[1..-1].gsub("/", "_") end |
.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.
239 240 241 242 243 |
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 239 def self.normalize_path(path) path = Journey::Router::Utils.normalize_path(path) path.gsub!(%r{/(\(+)/?}, '\1/') unless path =~ %r{^/\(+[^)]+\)$} path end |