Class: PaperTrailDiff::BatchedRootAnalyzer
- Inherits:
-
Object
- Object
- PaperTrailDiff::BatchedRootAnalyzer
- Defined in:
- lib/paper_trail_diff/batched_root_analyzer.rb,
sig/generated/paper_trail_diff/batched_root_analyzer.rbs
Overview
Builds one root's Analysis inside a batch, from versions the batch already selected and history it already prepared.
Instance Method Summary collapse
-
#activity_analysis(record, plan) ⇒ Analysis
: (untyped, RootVersionPlan) -> Analysis.
-
#call(record, plan) ⇒ Analysis
: (untyped, RootVersionPlan) -> Analysis.
-
#initialize(tree:, timeline_snapshotter:, activity_snapshotter:, preparer:, activity:) ⇒ BatchedRootAnalyzer
constructor
: (tree: AssociationTree, timeline_snapshotter: untyped, activity_snapshotter: untyped, preparer: untyped, activity: bool) -> void.
Constructor Details
#initialize(tree:, timeline_snapshotter:, activity_snapshotter:, preparer:, activity:) ⇒ BatchedRootAnalyzer
: (tree: AssociationTree, timeline_snapshotter: untyped, activity_snapshotter: untyped, preparer: untyped, activity: bool) -> void
9 10 11 12 13 14 15 |
# File 'lib/paper_trail_diff/batched_root_analyzer.rb', line 9 def initialize(tree:, timeline_snapshotter:, activity_snapshotter:, preparer:, activity:) @tree = tree @timeline_snapshotter = timeline_snapshotter @activity_snapshotter = activity_snapshotter @preparer = preparer @activity = activity end |
Instance Method Details
#activity_analysis(record, plan) ⇒ Analysis
: (untyped, RootVersionPlan) -> Analysis
41 42 43 44 45 46 47 48 |
# File 'lib/paper_trail_diff/batched_root_analyzer.rb', line 41 def activity_analysis(record, plan) range = TimelineRange.new( record, from: plan.versions.first, to: plan.versions.last, within: nil, plan: plan ) ActivityTimelineBuilder.new( record, range: range, tree: @tree, snapshotter: @activity_snapshotter ).analyze end |
#call(record, plan) ⇒ Analysis
: (untyped, RootVersionPlan) -> Analysis
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/paper_trail_diff/batched_root_analyzer.rb', line 18 def call(record, plan) @preparer.call(record.class, historical: true) return activity_analysis(record, plan) if @activity TimelineBuilder.new( record, from: plan.versions.first, to: plan.versions.last, within: nil, plan: plan, snapshotter: @timeline_snapshotter ).analyze end |