Actions
Bug #21538
openinitialize_dup not called when duping class/module
Description
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
No data to display
Actions
Like0