diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-13 15:16:25 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-13 15:16:25 -0700 |
commit | 4868692687f2904d2a02c1d6cd09882b6916cc5f (patch) | |
tree | 7c76897c944e5d02e2c0b34f02d7d01e404b8cdc /actionpack/lib | |
parent | 36f26fd47ecff07f229264560a68fca0d59911ca (diff) | |
download | rails-4868692687f2904d2a02c1d6cd09882b6916cc5f.tar.gz rails-4868692687f2904d2a02c1d6cd09882b6916cc5f.tar.bz2 rails-4868692687f2904d2a02c1d6cd09882b6916cc5f.zip |
pass anchor directly to `Pattern`
the caller already has it, there is no reason to pack it in to an object
and just throw that object away.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/path/pattern.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/journey/router/strexp.rb | 9 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 5 |
3 files changed, 9 insertions, 11 deletions
diff --git a/actionpack/lib/action_dispatch/journey/path/pattern.rb b/actionpack/lib/action_dispatch/journey/path/pattern.rb index 64b48ca45f..5d1680f3a7 100644 --- a/actionpack/lib/action_dispatch/journey/path/pattern.rb +++ b/actionpack/lib/action_dispatch/journey/path/pattern.rb @@ -7,14 +7,14 @@ module ActionDispatch attr_reader :spec, :requirements, :anchored def self.from_string string - new Journey::Router::Strexp.build(string, {}, ["/.?"], true) + new Journey::Router::Strexp.build(string, {}, ["/.?"]), true end - def initialize(strexp) + def initialize(strexp, anchored) @spec = strexp.ast @requirements = strexp.requirements @separators = strexp.separators.join - @anchored = strexp.anchor + @anchored = anchored @names = nil @optional_names = nil diff --git a/actionpack/lib/action_dispatch/journey/router/strexp.rb b/actionpack/lib/action_dispatch/journey/router/strexp.rb index 4b7738f335..53630ea87b 100644 --- a/actionpack/lib/action_dispatch/journey/router/strexp.rb +++ b/actionpack/lib/action_dispatch/journey/router/strexp.rb @@ -6,20 +6,19 @@ module ActionDispatch alias :compile :new end - attr_reader :path, :requirements, :separators, :anchor, :ast + attr_reader :path, :requirements, :separators, :ast - def self.build(path, requirements, separators, anchor = true) + def self.build(path, requirements, separators) parser = Journey::Parser.new ast = parser.parse path - new ast, path, requirements, separators, anchor + new ast, path, requirements, separators end - def initialize(ast, path, requirements, separators, anchor = true) + def initialize(ast, path, requirements, separators) @ast = ast @path = path @requirements = requirements @separators = separators - @anchor = anchor end end end diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index b72031633b..0455686ec0 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -541,10 +541,9 @@ module ActionDispatch ast, path, requirements, - SEPARATORS, - anchor) + SEPARATORS) - pattern = Journey::Path::Pattern.new(strexp) + pattern = Journey::Path::Pattern.new(strexp, anchor) builder = Journey::GTG::Builder.new ast |