RubyFlow The Ruby and Rails community linklog

DeepDive for deep controlled cloning of your Ruby objects

https://github.com/flajann2/deep_dive

DeepDive has been around for a while, and is quite stable. You can specify which variables in your object NOT to clone. So for instance, if you have a back-reference to a “god-object” that you would not want cloned, you would put

exclude :god_object

in your class definition. You will use #dclone and #dcopy instead of #clone and #copy, so you can still do shallow copies the usual way.

Note that I have not tested this with Rails, so it may not behave as expected there.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in