Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Includes:
Base, Concerns, HttpHelpers, Resources, Scoping, Redirection
Defined in:
actionpack/lib/action_dispatch/routing/mapper.rb

Defined Under Namespace

Modules: Base, Concerns, HttpHelpers, Resources, Scoping Classes: Constraints, Mapping, Scope

Constant Summary

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

Scoping::POISON

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resources

#add_route, #collection, #decomposed_match, #get_to_from_path, #match, #member, #namespace, #nested, #new, #resource, #resources, #resources_path_names, #root, #shallow, #shallow?, #using_match_shorthand?

Methods included from Concerns

#concern, #concerns

Methods included from Scoping

#constraints, #controller, #defaults, #namespace, #scope

Methods included from Redirection

#redirect

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

#initialize(set) ⇒ Mapper

:nodoc:



2092
2093
2094
2095
2096
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 2092

def initialize(set) #:nodoc:
  @set = set
  @scope = Scope.new({ :path_names => @set.resources_path_names })
  @concerns = {}
end

Class Method Details

.normalize_name(name) ⇒ Object



385
386
387
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 385

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.



379
380
381
382
383
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 379

def self.normalize_path(path)
  path = Journey::Router::Utils.normalize_path(path)
  path.gsub!(%r{/(\(+)/?}, '\1/') unless path =~ %r{^/\(+[^)]+\)$}
  path
end