diff options
-rw-r--r-- | actionpack/lib/action_dispatch/journey/path/pattern.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/journey/route.rb | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/journey/path/pattern.rb b/actionpack/lib/action_dispatch/journey/path/pattern.rb index 28c75618de..cb0a02c298 100644 --- a/actionpack/lib/action_dispatch/journey/path/pattern.rb +++ b/actionpack/lib/action_dispatch/journey/path/pattern.rb @@ -28,11 +28,10 @@ module ActionDispatch @required_names = nil @re = nil @offsets = nil - @format = Visitors::FormatBuilder.new.accept(spec) end - def format_path(path_options) - @format.evaluate path_options + def build_formatter + Visitors::FormatBuilder.new.accept(spec) end def ast diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb index d4df96314f..982ff3e259 100644 --- a/actionpack/lib/action_dispatch/journey/route.rb +++ b/actionpack/lib/action_dispatch/journey/route.rb @@ -31,6 +31,7 @@ module ActionDispatch @parts = nil @decorated_ast = nil @precedence = 0 + @formatter = @path.build_formatter end def ast @@ -76,7 +77,7 @@ module ActionDispatch value.to_s == defaults[key].to_s && !required_parts.include?(key) end - path.format_path path_options + @formatter.evaluate path_options end def optimized_path |