method
build_path
v3.2.8 -
Show latest stable
- Class:
ActionDispatch::Routing::RouteSet
build_path(path, requirements, separators, anchor)private
No documentation available.
# File actionpack/lib/action_dispatch/routing/route_set.rb, line 373
def build_path(path, requirements, separators, anchor)
strexp = Journey::Router::Strexp.new(
path,
requirements,
SEPARATORS,
anchor)
pattern = Journey::Path::Pattern.new(strexp)
builder = Journey::GTG::Builder.new pattern.spec
# Get all the symbol nodes followed by literals that are not the
# dummy node.
symbols = pattern.spec.grep(Journey::Nodes::Symbol).find_all { |n|
builder.followpos(n).first.literal?
}
# Get all the symbol nodes preceded by literals.
symbols.concat pattern.spec.find_all(&:literal?).map { |n|
builder.followpos(n).first
}.find_all(&:symbol?)
symbols.each { |x|
x.regexp = /(?:#{Regexp.union(x.regexp, '-')})+/
}
pattern
end