Permalink
Browse files

push the formatter up to the Route object

  • Loading branch information...
tenderlove committed May 21, 2014
1 parent e17aead commit 620cb0167667e2f5d788c11b637db51d20496dcc
@@ -28,11 +28,10 @@ def initialize(strexp)
@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
@@ -31,6 +31,7 @@ def initialize(name, app, path, constraints, defaults = {})
@parts = nil
@decorated_ast = nil
@precedence = 0
+ @formatter = @path.build_formatter
end
def ast
@@ -76,7 +77,7 @@ def format(path_options)
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

0 comments on commit 620cb01

Please sign in to comment.