aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorSam <sam.saffron@gmail.com>2018-02-16 09:19:57 +1100
committerRafael Mendonça França <rafaelmfranca@gmail.com>2018-02-15 17:34:31 -0500
commit23c5558f37c2c55807e7603415214f2b4b7b22c1 (patch)
tree795d2190ca1534f78076a7a051c6437262028d0e /actionpack
parent6781bd966df7f9cb89ed0beef679bf8feaf81610 (diff)
downloadrails-23c5558f37c2c55807e7603415214f2b4b7b22c1.tar.gz
rails-23c5558f37c2c55807e7603415214f2b4b7b22c1.tar.bz2
rails-23c5558f37c2c55807e7603415214f2b4b7b22c1.zip
correct the dedup code
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/journey/scanner.rb6
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]