Module: PaperTrailDiff::ActivityGrouping

Included in:
ActivityTimelineBuilder, TimeActivityTimelineBuilder
Defined in:
lib/paper_trail_diff/activity_grouping.rb,
sig/generated/paper_trail_diff/activity_grouping.rbs

Overview

Shared by the two activity builders. They differ in how they choose boundaries -- one from an explicit version range, one from a wall-clock window -- but a transaction has to collapse the same way in both, or the same history would read differently depending on how it was asked for.

Instance Method Summary collapse

Instance Method Details

#group_steps(steps) ⇒ Array[ActivityStep]

Applied last, to finished steps, so grouping sees the same timeline the caller would otherwise have received. : (Array) -> Array

Parameters:

Returns:



20
21
22
23
24
# File 'lib/paper_trail_diff/activity_grouping.rb', line 20

def group_steps(steps)
  return steps unless grouping?

  ActivityTransactionGrouper.new(steps, retain: @snapshots).call
end

#grouping?Boolean

: () -> bool

Returns:

  • (Boolean)


13
14
15
# File 'lib/paper_trail_diff/activity_grouping.rb', line 13

def grouping?
  @group == :transaction
end