Skip to content

Commit

Permalink
[RUBY-3387] Rephrase comment to specify that all attributes and embedded
Browse files Browse the repository at this point in the history
relations will be copied by default
  • Loading branch information
jjromeo committed Oct 22, 2024
1 parent 5dc4f94 commit 4ba8e3a
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# frozen_string_literal: true

module WasteCarriersEngine
# This responsible for safely copying attributes from a source instance of
# one class to a new instance of the targeted class. It ensures that only attributes
# that are defined in the target class are copied, excluding any specified attributes.
# The service also handles embedded relations recursively, processing nested
# attributes according to the target class definitions.
# This responsible for safely copying attributes and embedded relations from a source instance of
# one class to a new instance of the targeted class. By default it will copy every attribute except _id
# and every embedded relation that are defined in the target class. However, both attributes and embedded
# relations can be excluded by passing them into the attributes_to_exclude argument
# Embedded relations are processed recursively, and attributes to exclude
# will be applied to the embedded relations as well.

class SafeCopyAttributesService
def self.run(source_instance:, target_class:, attributes_to_exclude: [])
Expand Down

0 comments on commit 4ba8e3a

Please sign in to comment.