[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,15 +1269,12 @@ Also, a list:
$VERBOSE = old_verbose $VERBOSE = old_verbose
end end
class << self
# :nodoc: # :nodoc:
## ##
# Return the join path, with escaping backticks, dollars, and # Return the join path, with escaping backticks, dollars, and
# double-quotes. Unlike `shellescape`, equal-sign is not escaped. # double-quotes. Unlike `shellescape`, equal-sign is not escaped.
private def self.escape_path(*path)
def escape_path(*path)
path = File.join(*path) path = File.join(*path)
if %r{\A[-+:/=@,.\w]+\z}.match?(path) if %r{\A[-+:/=@,.\w]+\z}.match?(path)
path path
@ -1285,7 +1282,6 @@ Also, a list:
"\"#{path.gsub(/[`$"]/, '\\&')}\"" "\"#{path.gsub(/[`$"]/, '\\&')}\""
end end
end end
end
@@good_rake = "#{rubybin} #{escape_path(__dir__, "good_rake.rb")}" @@good_rake = "#{rubybin} #{escape_path(__dir__, "good_rake.rb")}"
@@bad_rake = "#{rubybin} #{escape_path(__dir__, "bad_rake.rb")}" @@bad_rake = "#{rubybin} #{escape_path(__dir__, "bad_rake.rb")}"