Maintenance Ruby 3.3 gets fixes, but no new features. 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-3.3.0/lib/rubygems/specification.rb, line 2708
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
See also
#require_paths=
#ri_dir
#require_path=
#ruby_code
also in
4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0