class Object

This file was copied from Rails 5.2 #

Public Instance Methods

deep_dup() click to toggle source

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
# File lib/raven/core_ext/object/deep_dup.rb, line 17
def deep_dup
  duplicable? ? dup : self
end
duplicable?() click to toggle source

Can you safely dup this object?

False for method objects; true otherwise.

# File lib/raven/core_ext/object/duplicable.rb, line 30
def duplicable?
  true
end