One thing I love about ruby is that mostly it is a very readable language (which is great for self-documenting code)
However, inspired by this question: Ruby Code ex
You can deepcopy with Marshaling object easily. - taken from The Ruby Programming Language
def deepcopy(o)
Marshal.load(Marshal.dump(o))
end
Note that files and I/O streams, as well as Method and Binding objects, are too dynamic to be marshaled; there would be no reliable way to restore their state.