aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/journey/path/pattern.rb5
-rw-r--r--actionpack/lib/action_dispatch/journey/router/strexp.rb5
2 files changed, 7 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/journey/path/pattern.rb b/actionpack/lib/action_dispatch/journey/path/pattern.rb
index cb0a02c298..da9d54cf6a 100644
--- a/actionpack/lib/action_dispatch/journey/path/pattern.rb
+++ b/actionpack/lib/action_dispatch/journey/path/pattern.rb
@@ -5,17 +5,16 @@ module ActionDispatch
attr_reader :spec, :requirements, :anchored
def initialize(strexp)
- parser = Journey::Parser.new
-
@anchored = true
case strexp
when String
+ parser = Journey::Parser.new
@spec = parser.parse(strexp)
@requirements = {}
@separators = "/.?"
when Router::Strexp
- @spec = parser.parse(strexp.path)
+ @spec = strexp.ast
@requirements = strexp.requirements
@separators = strexp.separators.join
@anchored = strexp.anchor
diff --git a/actionpack/lib/action_dispatch/journey/router/strexp.rb b/actionpack/lib/action_dispatch/journey/router/strexp.rb
index f97f1a223e..161b41d6b2 100644
--- a/actionpack/lib/action_dispatch/journey/router/strexp.rb
+++ b/actionpack/lib/action_dispatch/journey/router/strexp.rb
@@ -15,6 +15,11 @@ module ActionDispatch
@anchor = anchor
end
+ def ast
+ parser = Journey::Parser.new
+ parser.parse path
+ end
+
def names
@path.scan(/:\w+/).map { |s| s.tr(':', '') }
end