Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::Specification#initialize_copy
(self object) -> self
initialize_copy(other_spec)
lib/rubygems/specification.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/specification.rb, line 2006
def initialize_copy(other_spec)
self.class.array_attributes.each do |name|
name = :"@#{name}"
next unless other_spec.instance_variable_defined? name
begin
val = other_spec.instance_variable_get(name)
if val
instance_variable_set name, val.dup
elsif Gem.configuration.really_verbose
warn "WARNING: #{full_name} has an invalid nil value for #{name}"
end
rescue TypeError
e = Gem::FormatException.new \
"#{full_name} has an invalid value for #{name}"
e.file_path = loaded_from
raise e
end
end
@required_ruby_version = other_spec.required_ruby_version.dup
@required_rubygems_version = other_spec.required_rubygems_version.dup
end
Duplicates Array and Gem::Requirement attributes from other_spec so state isn’t shared.
See also
#has_conflicts?
#keep_only_files_and_directories
#gems_dir
#lib_files
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0