diff options
author | Sam <sam.saffron@gmail.com> | 2018-02-16 09:19:57 +1100 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-02-15 17:34:31 -0500 |
commit | 23c5558f37c2c55807e7603415214f2b4b7b22c1 (patch) | |
tree | 795d2190ca1534f78076a7a051c6437262028d0e | |
parent | 6781bd966df7f9cb89ed0beef679bf8feaf81610 (diff) | |
download | rails-23c5558f37c2c55807e7603415214f2b4b7b22c1.tar.gz rails-23c5558f37c2c55807e7603415214f2b4b7b22c1.tar.bz2 rails-23c5558f37c2c55807e7603415214f2b4b7b22c1.zip |
correct the dedup code
-rw-r--r-- | actionpack/lib/action_dispatch/journey/scanner.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/journey/scanner.rb b/actionpack/lib/action_dispatch/journey/scanner.rb index 5ed587c1b1..2a075862e9 100644 --- a/actionpack/lib/action_dispatch/journey/scanner.rb +++ b/actionpack/lib/action_dispatch/journey/scanner.rb @@ -33,7 +33,7 @@ module ActionDispatch end private - + # takes advantage of String @- deduping capabilities in Ruby 2.5 upwards # see: https://bugs.ruby-lang.org/issues/13077 def dedup_scan(regex) @@ -58,9 +58,9 @@ module ActionDispatch [:SYMBOL, text] when text = dedup_scan(/\*\w+/) [:STAR, text] - when text = dedup_scan(/(?:[\w%\-~!$&'*+,;=@]|\\[:()])+/) + when text = @ss.scan(/(?:[\w%\-~!$&'*+,;=@]|\\[:()])+/) text.tr! "\\", "" - [:LITERAL, text] + [:LITERAL, -text] # any char when text = dedup_scan(/./) [:LITERAL, text] |