Class: PaperTrailDiff::CollectionTransition
- Inherits:
-
Object
- Object
- PaperTrailDiff::CollectionTransition
- Defined in:
- lib/paper_trail_diff/collection_transition.rb,
sig/generated/paper_trail_diff/collection_transition.rbs
Overview
One collection mutation between structurally adjacent snapshots.
Instance Attribute Summary collapse
- #after ⇒ RecordSnapshot? readonly
- #before ⇒ RecordSnapshot? readonly
Instance Method Summary collapse
-
#from?(association) ⇒ Boolean
: (AssociationSnapshot) -> bool.
-
#initialize(from:, before:, after:) ⇒ CollectionTransition
constructor
The origin is recorded by serial rather than by reference, because holding it would retain every earlier snapshot at the same path for the whole timeline.
Constructor Details
#initialize(from:, before:, after:) ⇒ CollectionTransition
The origin is recorded by serial rather than by reference, because holding it would retain every earlier snapshot at the same path for the whole timeline. : (from: AssociationSnapshot, before: RecordSnapshot?, after: RecordSnapshot?) -> void
14 15 16 17 18 19 |
# File 'lib/paper_trail_diff/collection_transition.rb', line 14 def initialize(from:, before:, after:) @from_serial = from.serial @before = before @after = after freeze end |
Instance Attribute Details
#after ⇒ RecordSnapshot? (readonly)
8 9 10 |
# File 'lib/paper_trail_diff/collection_transition.rb', line 8 def after @after end |
#before ⇒ RecordSnapshot? (readonly)
7 8 9 |
# File 'lib/paper_trail_diff/collection_transition.rb', line 7 def before @before end |
Instance Method Details
#from?(association) ⇒ Boolean
: (AssociationSnapshot) -> bool
22 23 24 |
# File 'lib/paper_trail_diff/collection_transition.rb', line 22 def from?(association) @from_serial == association.serial end |