[rubygems/rubygems] Extract class method used by self.method

https://github.com/rubygems/rubygems/commit/d900453ca2
This commit is contained in:
Hiroshi SHIBATA 2023-04-05 11:05:05 +09:00 committed by git
parent 7f9a5a7562
commit 8e37eb1d15

View File

@ -1269,21 +1269,17 @@ Also, a list:
$VERBOSE = old_verbose
end
class << self
# :nodoc:
##
# Return the join path, with escaping backticks, dollars, and
# double-quotes. Unlike `shellescape`, equal-sign is not escaped.
# :nodoc:
##
# Return the join path, with escaping backticks, dollars, and
# double-quotes. Unlike `shellescape`, equal-sign is not escaped.
private
def escape_path(*path)
path = File.join(*path)
if %r{\A[-+:/=@,.\w]+\z}.match?(path)
path
else
"\"#{path.gsub(/[`$"]/, '\\&')}\""
end
def self.escape_path(*path)
path = File.join(*path)
if %r{\A[-+:/=@,.\w]+\z}.match?(path)
path
else
"\"#{path.gsub(/[`$"]/, '\\&')}\""
end
end