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
148 149 150 151 152 153 154 |
# File 'lib/paper_trail_diff/value_objects.rb', line 148 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)
143 144 145 |
# File 'lib/paper_trail_diff/value_objects.rb', line 143 def added @added end |
#changed ⇒ Array[RecordChange] (readonly)
145 146 147 |
# File 'lib/paper_trail_diff/value_objects.rb', line 145 def changed @changed end |
#kind ⇒ Symbol (readonly)
142 143 144 |
# File 'lib/paper_trail_diff/value_objects.rb', line 142 def kind @kind end |
#removed ⇒ Array[RecordSnapshot] (readonly)
144 145 146 |
# File 'lib/paper_trail_diff/value_objects.rb', line 144 def removed @removed end |
Instance Method Details
#empty? ⇒ Boolean
: () -> bool
157 158 159 |
# File 'lib/paper_trail_diff/value_objects.rb', line 157 def empty? added.empty? && removed.empty? && changed.empty? end |