[#122973] [PATCH] Add Gem.default_install — Felipe Contreras via ruby-core <ruby-core@...>
We need a way to enable user installs by default so that tools like
3 messages
2025/08/17
[ruby-core:122945] [Ruby Bug#21538] initialize_dup not called when duping class/module
From:
"chucke (Tiago Cardoso) via ruby-core" <ruby-core@...>
Date:
2025-08-11 13:26:23 UTC
List:
ruby-core #122945
Issue #21538 has been reported by chucke (Tiago Cardoso).
----------------------------------------
Bug #21538: initialize_dup not called when duping class/module
https://bugs.ruby-lang.org/issues/21538
* Author: chucke (Tiago Cardoso)
* Status: Open
* ruby -v: 3.4.5
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Not sure whether this is expected behaviour or not, but just leaving it here to start the debate on whether callbacks like `initialize_dup` are supposed to be called when a module or class is duped (the same happens with `initialize_copy` and `initialize_clone` btw):
class A
def initialize_dup(_)
puts "dup instance"
super
end
def self.initialize_dup(_)
puts "dup class"
super
end
end
A.new.dup #=> "dup instance"
A.dup #=> nothing
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/