diff options
author | Nicolas Cavigneaux <nico@bounga.org> | 2014-10-14 22:32:23 +0200 |
---|---|---|
committer | Nicolas Cavigneaux <nico@bounga.org> | 2014-10-14 22:32:23 +0200 |
commit | 1c7dd65637214af0e31e23958df0d96d071897b4 (patch) | |
tree | 43429178ccc779e762aeca63a8c6f5c43c1299a3 /actionpack | |
parent | 6bb040b55748269dd2cb2ae3a36fa54ca7c70c5e (diff) | |
download | rails-1c7dd65637214af0e31e23958df0d96d071897b4.tar.gz rails-1c7dd65637214af0e31e23958df0d96d071897b4.tar.bz2 rails-1c7dd65637214af0e31e23958df0d96d071897b4.zip |
Use `#tr` instead of `#gsub`
`#tr` is more efficient than `#gsub` and can be used as a drop in
replacement in this context.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/scanner.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/journey/scanner.rb b/actionpack/lib/action_dispatch/journey/scanner.rb index ad1cd0f5e8..19e0bc03d6 100644 --- a/actionpack/lib/action_dispatch/journey/scanner.rb +++ b/actionpack/lib/action_dispatch/journey/scanner.rb @@ -50,7 +50,7 @@ module ActionDispatch when text = @ss.scan(/(?<!\\):\w+/) [:SYMBOL, text] when text = @ss.scan(/(?:[\w%\-~!$&'*+,;=@]|\\:|\\\(|\\\))+/) - [:LITERAL, text.gsub('\\', '')] + [:LITERAL, text.tr('\\', '')] # any char when text = @ss.scan(/./) [:LITERAL, text] |