class ActionDispatch::Routing::Mapper

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/action_dispatch/routing/mapper.rbs

class ActionDispatch::Routing::Mapper
  def self.normalize_path: (String path) -> String
end

def self.normalize_name(name)

def self.normalize_name(name)
  normalize_path(name)[1..-1].tr("/", "_")
end

def self.normalize_path(path)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.normalize_path: (String path) -> String

This signature was generated using 1 sample from 1 application.

former is the correct one.
/(:locale) becomes (/:locale). Except for root cases, where the
Invokes Journey::Router::Utils.normalize_path, then ensures that
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

def initialize(set) # :nodoc:

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