[rubygems/rubygems] Gem::Specification#to_ruby doesn't need openssl

The `openssl` require when openssl not present was having the
side-effect the our custom require fallbacks would end up loading `Gem::Specification.stubs`.

Co-authored-by: Alyssa Ross <hi@alyssa.is>

https://github.com/rubygems/rubygems/commit/22c4ded4ad
This commit is contained in:
David Rodríguez 2020-06-29 18:43:40 +02:00 committed by Hiroshi SHIBATA
parent 6608bc77b6
commit ea8f7d4a81
Notes: git 2020-07-31 21:08:14 +09:00

View File

@ -2411,7 +2411,7 @@ class Gem::Specification < Gem::BasicSpecification
# still have their default values are omitted. # still have their default values are omitted.
def to_ruby def to_ruby
require 'openssl' require_relative 'openssl'
mark_version mark_version
result = [] result = []
result << "# -*- encoding: utf-8 -*-" result << "# -*- encoding: utf-8 -*-"
@ -2451,7 +2451,7 @@ class Gem::Specification < Gem::BasicSpecification
next if handled.include? attr_name next if handled.include? attr_name
current_value = self.send(attr_name) current_value = self.send(attr_name)
if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name) if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name)
result << " s.#{attr_name} = #{ruby_code current_value}" unless current_value.is_a?(OpenSSL::PKey::RSA) result << " s.#{attr_name} = #{ruby_code current_value}" unless defined?(OpenSSL::PKey::RSA) && current_value.is_a?(OpenSSL::PKey::RSA)
end end
end end