Class: Object

Inherits:
BasicObject
Defined in:
lib/koto/core_ext/object.rb

Instance Method Summary collapse

Instance Method Details

#deep_dupObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/koto/core_ext/object.rb', line 4

def deep_dup
  copy = self.dup

  copy.instance_variables.each do |attr|
    value = instance_variable_get(attr).dup
    copy.instance_variable_set attr, value
  end

  copy
end