diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-13 15:42:46 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-13 15:42:46 -0700 |
commit | 947ebe9a6d516271092853f8164c414f126cff6e (patch) | |
tree | a510820e8824a158f3f8ab70f7b4a8812469ef6a /actionpack/lib | |
parent | 4868692687f2904d2a02c1d6cd09882b6916cc5f (diff) | |
download | rails-947ebe9a6d516271092853f8164c414f126cff6e.tar.gz rails-947ebe9a6d516271092853f8164c414f126cff6e.tar.bz2 rails-947ebe9a6d516271092853f8164c414f126cff6e.zip |
remove Strexp
This was a useless object. We can just directly construct a
Path::Pattern object without a Strexp object.
Diffstat (limited to 'actionpack/lib')
4 files changed, 12 insertions, 41 deletions
diff --git a/actionpack/lib/action_dispatch/journey/path/pattern.rb b/actionpack/lib/action_dispatch/journey/path/pattern.rb index 5d1680f3a7..24b90e214d 100644 --- a/actionpack/lib/action_dispatch/journey/path/pattern.rb +++ b/actionpack/lib/action_dispatch/journey/path/pattern.rb @@ -1,5 +1,3 @@ -require 'action_dispatch/journey/router/strexp' - module ActionDispatch module Journey # :nodoc: module Path # :nodoc: @@ -7,13 +5,19 @@ module ActionDispatch attr_reader :spec, :requirements, :anchored def self.from_string string - new Journey::Router::Strexp.build(string, {}, ["/.?"]), true + build(string, {}, ["/.?"], true) + end + + def self.build(path, requirements, separators, anchored) + parser = Journey::Parser.new + ast = parser.parse path + new ast, requirements, separators, anchored end - def initialize(strexp, anchored) - @spec = strexp.ast - @requirements = strexp.requirements - @separators = strexp.separators.join + def initialize(ast, requirements, separators, anchored) + @spec = ast + @requirements = requirements + @separators = separators.join @anchored = anchored @names = nil diff --git a/actionpack/lib/action_dispatch/journey/router.rb b/actionpack/lib/action_dispatch/journey/router.rb index b84aad8eb6..31b6731a67 100644 --- a/actionpack/lib/action_dispatch/journey/router.rb +++ b/actionpack/lib/action_dispatch/journey/router.rb @@ -1,5 +1,4 @@ require 'action_dispatch/journey/router/utils' -require 'action_dispatch/journey/router/strexp' require 'action_dispatch/journey/routes' require 'action_dispatch/journey/formatter' diff --git a/actionpack/lib/action_dispatch/journey/router/strexp.rb b/actionpack/lib/action_dispatch/journey/router/strexp.rb deleted file mode 100644 index 53630ea87b..0000000000 --- a/actionpack/lib/action_dispatch/journey/router/strexp.rb +++ /dev/null @@ -1,26 +0,0 @@ -module ActionDispatch - module Journey # :nodoc: - class Router # :nodoc: - class Strexp # :nodoc: - class << self - alias :compile :new - end - - attr_reader :path, :requirements, :separators, :ast - - def self.build(path, requirements, separators) - parser = Journey::Parser.new - ast = parser.parse path - new ast, path, requirements, separators - end - - def initialize(ast, path, requirements, separators) - @ast = ast - @path = path - @requirements = requirements - @separators = separators - end - end - end - end -end diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 0455686ec0..e549316f24 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -537,13 +537,7 @@ module ActionDispatch end def build_path(path, ast, requirements, anchor) - strexp = Journey::Router::Strexp.new( - ast, - path, - requirements, - SEPARATORS) - - pattern = Journey::Path::Pattern.new(strexp, anchor) + pattern = Journey::Path::Pattern.new(ast, requirements, SEPARATORS, anchor) builder = Journey::GTG::Builder.new ast |