Open ghost opened 11 years ago
For now you have to use lambda
thing, but if you will make a library which will do genering __deep_copy__
accessible, I will be happy to use it. For example, you can take a look and maybe extract it from origin gem.
Since Ruby relies heavily on references, directly modifying an attribute for an object using the default value will in some cases modify the default value instead of the instance object. Example:
Either the
attribute
method needs to be aware of this "gotcha" or it needs to be well-documented to use procs as a workaround: