Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::Specification#reset_nil_attributes_to_default
reset_nil_attributes_to_default
lib/rubygems/specification.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/specification.rb, line 2632
def reset_nil_attributes_to_default
nil_attributes = self.class.non_nil_attributes.find_all do |name|
!instance_variable_defined?("@#{name}") || instance_variable_get("@#{name}").nil?
end
nil_attributes.each do |attribute|
default = default_value attribute
value = case default
when Time, Numeric, Symbol, true, false, nil then default
else default.dup
end
instance_variable_set "@#{attribute}", value
end
@installed_by_version ||= nil
nil
end
Reset nil attributes to their default values to make the spec valid