From 947ebe9a6d516271092853f8164c414f126cff6e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 13 Aug 2015 15:42:46 -0700 Subject: remove Strexp This was a useless object. We can just directly construct a Path::Pattern object without a Strexp object. --- .../lib/action_dispatch/journey/path/pattern.rb | 18 +++++++++------ actionpack/lib/action_dispatch/journey/router.rb | 1 - .../lib/action_dispatch/journey/router/strexp.rb | 26 ---------------------- .../lib/action_dispatch/routing/route_set.rb | 8 +------ 4 files changed, 12 insertions(+), 41 deletions(-) delete mode 100644 actionpack/lib/action_dispatch/journey/router/strexp.rb (limited to 'actionpack/lib') 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 -- cgit v1.2.3