1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Prefer tr to gsub when replacing path separators

This is not detected by the `Performance/StringReplacement` cop, I guess
because of using constants. But still seems like a good change.

Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>

https://github.com/rubygems/rubygems/commit/f862103133
This commit is contained in:
David Rodríguez 2020-05-02 12:37:57 +02:00 committed by Hiroshi SHIBATA
parent de57d3895e
commit 0d7e0eb2fa
Notes: git 2020-05-08 14:14:22 +09:00

View file

@ -709,7 +709,7 @@ class Gem::Installer
return if self.class.path_warning return if self.class.path_warning
user_bin_dir = @bin_dir || Gem.bindir(gem_home) user_bin_dir = @bin_dir || Gem.bindir(gem_home)
user_bin_dir = user_bin_dir.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if user_bin_dir = user_bin_dir.tr(File::SEPARATOR, File::ALT_SEPARATOR) if
File::ALT_SEPARATOR File::ALT_SEPARATOR
path = ENV['PATH'] path = ENV['PATH']