Class: PaperTrailDiff::CollectionAssociationDiff
- Inherits:
-
Object
- Object
- PaperTrailDiff::CollectionAssociationDiff
- Defined in:
- lib/paper_trail_diff/value_objects.rb,
sig/generated/paper_trail_diff/value_objects.rbs
Overview
Membership and associated-record changes for has_many.
Instance Attribute Summary collapse
- #added ⇒ Array[RecordSnapshot] readonly
- #changed ⇒ Array[RecordChange] readonly
- #kind ⇒ Symbol readonly
- #removed ⇒ Array[RecordSnapshot] readonly
Instance Method Summary collapse
-
#empty? ⇒ Boolean
: () -> bool.
- #initialize(kind:, added:, removed:, changed:) ⇒ CollectionAssociationDiff constructor
-
#to_h ⇒ Hash[Symbol, untyped]
: () -> Hash[Symbol, untyped].
Constructor Details
#initialize(kind:, added:, removed:, changed:) ⇒ CollectionAssociationDiff
82 83 84 85 86 87 88 |
# File 'lib/paper_trail_diff/value_objects.rb', line 82 def initialize(kind:, added:, removed:, changed:) @kind = kind @added = added.dup.freeze @removed = removed.dup.freeze @changed = changed.dup.freeze freeze end |
Instance Attribute Details
#added ⇒ Array[RecordSnapshot] (readonly)
77 78 79 |
# File 'lib/paper_trail_diff/value_objects.rb', line 77 def added @added end |
#changed ⇒ Array[RecordChange] (readonly)
79 80 81 |
# File 'lib/paper_trail_diff/value_objects.rb', line 79 def changed @changed end |
#kind ⇒ Symbol (readonly)
76 77 78 |
# File 'lib/paper_trail_diff/value_objects.rb', line 76 def kind @kind end |
#removed ⇒ Array[RecordSnapshot] (readonly)
78 79 80 |
# File 'lib/paper_trail_diff/value_objects.rb', line 78 def removed @removed end |
Instance Method Details
#empty? ⇒ Boolean
: () -> bool
91 92 93 |
# File 'lib/paper_trail_diff/value_objects.rb', line 91 def empty? added.empty? && removed.empty? && changed.empty? end |