Class: PaperTrailDiff::ActivityEventRecordNormalizer
- Inherits:
-
Object
- Object
- PaperTrailDiff::ActivityEventRecordNormalizer
- Defined in:
- lib/paper_trail_diff/activity_event_record_normalizer.rb,
sig/generated/paper_trail_diff/activity_event_record_normalizer.rbs
Overview
Normalizes one event record with the historical reader for its boundary.
Instance Method Summary collapse
-
#call(record, reflection:, subtree:, path:, normalizer:, root_endpoint:, context_endpoint:) ⇒ RecordSnapshot?
: (untyped, reflection: untyped, subtree: AssociationTree, path: String, normalizer: SnapshotNormalizer, root_endpoint: untyped, context_endpoint: untyped) -> RecordSnapshot?.
-
#historical_reader(context_endpoint, habtm_version:) ⇒ HistoricalAssociationReifier
: (untyped, habtm_version: untyped) -> HistoricalAssociationReifier.
-
#initialize(association_reader: nil) ⇒ ActivityEventRecordNormalizer
constructor
: (?association_reader: untyped) -> void.
Constructor Details
#initialize(association_reader: nil) ⇒ ActivityEventRecordNormalizer
: (?association_reader: untyped) -> void
8 9 10 |
# File 'lib/paper_trail_diff/activity_event_record_normalizer.rb', line 8 def initialize(association_reader: nil) @association_reader = association_reader || method(:historical_reader) end |
Instance Method Details
#call(record, reflection:, subtree:, path:, normalizer:, root_endpoint:, context_endpoint:) ⇒ RecordSnapshot?
: (untyped, reflection: untyped, subtree: AssociationTree, path: String, normalizer: SnapshotNormalizer, root_endpoint: untyped, context_endpoint: untyped) -> RecordSnapshot?
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/paper_trail_diff/activity_event_record_normalizer.rb', line 13 def call( # rubocop:disable Metrics/ParameterLists record, reflection:, subtree:, path:, normalizer:, root_endpoint:, context_endpoint: ) boundary = Endpoint.version?(root_endpoint) ? root_endpoint : context_endpoint reifier = @association_reader.call(context_endpoint, habtm_version: boundary) normalizer.call_child( record, tree: subtree, path: path, incoming: reflection, reifier: reifier ) end |
#historical_reader(context_endpoint, habtm_version:) ⇒ HistoricalAssociationReifier
: (untyped, habtm_version: untyped) -> HistoricalAssociationReifier
38 39 40 |
# File 'lib/paper_trail_diff/activity_event_record_normalizer.rb', line 38 def historical_reader(context_endpoint, habtm_version:) HistoricalAssociationReifier.new(context_endpoint, habtm_version: habtm_version) end |