aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/journey/path/pattern.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/journey/path/pattern.rb')
-rw-r--r--actionpack/lib/action_dispatch/journey/path/pattern.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/journey/path/pattern.rb b/actionpack/lib/action_dispatch/journey/path/pattern.rb
index da9d54cf6a..c39f8e850a 100644
--- a/actionpack/lib/action_dispatch/journey/path/pattern.rb
+++ b/actionpack/lib/action_dispatch/journey/path/pattern.rb
@@ -1,18 +1,17 @@
+require 'action_dispatch/journey/router/strexp'
+
module ActionDispatch
module Journey # :nodoc:
module Path # :nodoc:
class Pattern # :nodoc:
attr_reader :spec, :requirements, :anchored
- def initialize(strexp)
- @anchored = true
+ def self.from_string string
+ new Journey::Router::Strexp.build(string, {}, ["/.?"], true)
+ end
+ def initialize(strexp)
case strexp
- when String
- parser = Journey::Parser.new
- @spec = parser.parse(strexp)
- @requirements = {}
- @separators = "/.?"
when Router::Strexp
@spec = strexp.ast
@requirements = strexp.requirements