pass the parsed path from mapper to the Strexp
This commit is contained in:
parent
15ffbedf3b
commit
333a4d09ab
@ -80,7 +80,7 @@ def initialize(set, scope, path, options)
|
||||
path_params = path_params ast
|
||||
@options = normalize_options!(options, path_params, ast)
|
||||
normalize_requirements!(path_params)
|
||||
normalize_conditions!(path_params, path)
|
||||
normalize_conditions!(path_params, path, ast)
|
||||
normalize_defaults!
|
||||
end
|
||||
|
||||
@ -192,8 +192,9 @@ def verify_callable_constraint(callable_constraint)
|
||||
end
|
||||
end
|
||||
|
||||
def normalize_conditions!(path_params, path)
|
||||
def normalize_conditions!(path_params, path, ast)
|
||||
@conditions[:path_info] = path
|
||||
@conditions[:parsed_path_info] = ast
|
||||
|
||||
constraints.each do |key, condition|
|
||||
unless path_params.include?(key) || key == :controller
|
||||
|
@ -418,7 +418,9 @@ def add_route(app, conditions = {}, requirements = {}, defaults = {}, name = nil
|
||||
"http://guides.rubyonrails.org/routing.html#restricting-the-routes-created"
|
||||
end
|
||||
|
||||
path = build_path(conditions.delete(:path_info), requirements, SEPARATORS, anchor)
|
||||
path = conditions.delete :path_info
|
||||
ast = conditions.delete :parsed_path_info
|
||||
path = build_path(path, ast, requirements, SEPARATORS, anchor)
|
||||
conditions = build_conditions(conditions, path.names.map { |x| x.to_sym })
|
||||
|
||||
route = @set.add_route(app, path, conditions, defaults, name)
|
||||
@ -426,8 +428,9 @@ def add_route(app, conditions = {}, requirements = {}, defaults = {}, name = nil
|
||||
route
|
||||
end
|
||||
|
||||
def build_path(path, requirements, separators, anchor)
|
||||
strexp = Journey::Router::Strexp.build(
|
||||
def build_path(path, ast, requirements, separators, anchor)
|
||||
strexp = Journey::Router::Strexp.new(
|
||||
ast,
|
||||
path,
|
||||
requirements,
|
||||
SEPARATORS,
|
||||
|
Loading…
Reference in New Issue
Block a user