Class: PaperTrailDiff::TimelineSnapshotProvider
- Inherits:
-
Object
- Object
- PaperTrailDiff::TimelineSnapshotProvider
- Defined in:
- lib/paper_trail_diff/timeline_snapshot_provider.rb,
sig/generated/paper_trail_diff/timeline_snapshot_provider.rbs
Overview
Gives TimelineBuilder one-argument access to a range-prepared snapshot store.
Instance Method Summary collapse
-
#call(endpoint) ⇒ RecordSnapshot?
A window closing on current state ends at the live record rather than at a version, which is the one endpoint no version history can reconstruct.
-
#initialize(store, live_snapshotter:) ⇒ TimelineSnapshotProvider
constructor
: (HistoricalSnapshotStore, live_snapshotter: untyped) -> void.
-
#live_snapshot(record) ⇒ RecordSnapshot?
: (untyped) -> RecordSnapshot?.
-
#prepare(record, versions) ⇒ void
: (untyped, Array) -> void.
Constructor Details
#initialize(store, live_snapshotter:) ⇒ TimelineSnapshotProvider
: (HistoricalSnapshotStore, live_snapshotter: untyped) -> void
8 9 10 11 |
# File 'lib/paper_trail_diff/timeline_snapshot_provider.rb', line 8 def initialize(store, live_snapshotter:) @store = store @live_snapshotter = live_snapshotter end |
Instance Method Details
#call(endpoint) ⇒ RecordSnapshot?
A window closing on current state ends at the live record rather than at a version, which is the one endpoint no version history can reconstruct. : (untyped) -> RecordSnapshot?
21 22 23 24 25 |
# File 'lib/paper_trail_diff/timeline_snapshot_provider.rb', line 21 def call(endpoint) return live_snapshot(endpoint) if Endpoint.record?(endpoint) @store.uncached(endpoint, endpoint) end |
#live_snapshot(record) ⇒ RecordSnapshot?
: (untyped) -> RecordSnapshot?
30 31 32 |
# File 'lib/paper_trail_diff/timeline_snapshot_provider.rb', line 30 def live_snapshot(record) @live_snapshotter.call(record) end |
#prepare(record, versions) ⇒ void
This method returns an undefined value.
: (untyped, Array) -> void
14 15 16 |
# File 'lib/paper_trail_diff/timeline_snapshot_provider.rb', line 14 def prepare(record, versions) @store.prepare(record, versions) end |