Module: Para::Cloneable
- Extended by:
- ActiveSupport::Autoload, ActiveSupport::Concern
- Defined in:
- lib/para/cloneable.rb,
lib/para/cloneable/attachments_cloner.rb,
lib/para/cloneable/include_tree_builder.rb
Defined Under Namespace
Modules: ClassMethods Classes: AttachmentsCloner, IncludeTreeBuilder
Instance Method Summary collapse
-
#deep_clone!(options = {}) ⇒ Object
Wraps the deep_cloneable gem #deep_clone method to allow using the predefined associations and options from our Cloneable.acts_as_cloneable macro.
Instance Method Details
#deep_clone!(options = {}) ⇒ Object
Wraps the deep_cloneable gem #deep_clone method to allow using the predefined associations and options from our Cloneable.acts_as_cloneable macro.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/para/cloneable.rb', line 19 def deep_clone!( = {}) dictionary = [:dictionary] ||= {} = Para::Cloneable::IncludeTreeBuilder.new(self).build = .reverse_merge() callback = build_clone_callback(.delete(:prepare)) deep_clone() do |original, clone| Para::Cloneable::AttachmentsCloner.new(original, clone, dictionary).clone! callback&.call(original, clone) end end |