Skip to content

Commit

Permalink
Avoid adding OpenSSL::PKey::RSA instances
Browse files Browse the repository at this point in the history
  • Loading branch information
bronzdoc committed Sep 17, 2019
1 parent 2e65f7d commit ba021fb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/rubygems/specification.rb
Expand Up @@ -2303,7 +2303,6 @@ def ruby_code(obj)
when Time then obj.strftime('%Y-%m-%d').dump
when Numeric then obj.inspect
when true, false, nil then obj.inspect
when OpenSSL::PKey::RSA then obj.class
when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
when Gem::Requirement then
list = obj.as_list
Expand Down Expand Up @@ -2462,9 +2461,8 @@ def to_ruby
@@attributes.each do |attr_name|
next if handled.include? attr_name
current_value = self.send(attr_name)
if current_value != default_value(attr_name) or
self.class.required_attribute? attr_name
result << " s.#{attr_name} = #{ruby_code current_value}"
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)
end
end

Expand Down

0 comments on commit ba021fb

Please sign in to comment.