method

deep_dup

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: Object
deep_dup() public

Returns a deep copy of object if it’s duplicable. If it’s not duplicable, returns self.

object = Object.new
dup    = object.deep_dup
dup.instance_variable_set(:@a, 1)

object.instance_variable_defined?(:@a) # => false
dup.instance_variable_defined?(:@a)    # => true
Show source
Register or log in to add new notes.