Class: PaperTrailDiff::ScopedAnalysis

Inherits:
Object
  • Object
show all
Defined in:
lib/paper_trail_diff/scoped_analysis.rb,
sig/generated/paper_trail_diff/scoped_analysis.rbs

Overview

What the relation form of analyze_many returns: the analyses, plus the roots the relation could not reach.

to_ary is defined so the pair destructures, which keeps the common case reading like the plain Hash the record form returns:

analyses, unreachable = PaperTrailDiff.analyze_many(scope: ..., limit: 500)

It deliberately does not pretend to be a Hash beyond that. Somebody iterating this object should have to decide which half they meant.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(analyses:, unreachable:) ⇒ ScopedAnalysis

: (analyses: Hash[Array[String], Analysis], unreachable: Array[Array[String]]) -> void

Parameters:

  • analyses: (Hash[Array[String], Analysis])
  • unreachable: (Array[Array[String]])


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

def initialize(analyses:, unreachable:)
  @analyses = analyses
  @unreachable = Support.immutable_copy(unreachable)
  freeze
end

Instance Attribute Details

#analysesHash[Array[String], Analysis] (readonly)

Signature:

  • Hash[Array[String], Analysis]

Returns:



16
17
18
# File 'lib/paper_trail_diff/scoped_analysis.rb', line 16

def analyses
  @analyses
end

#unreachableArray[Array[String]] (readonly)

Signature:

  • Array[Array[String]]

Returns:

  • (Array[Array[String]])


17
18
19
# File 'lib/paper_trail_diff/scoped_analysis.rb', line 17

def unreachable
  @unreachable
end

Instance Method Details

#to_ary[ Hash[Array[String], Analysis], Array[Array[String]] ]

: () -> [Hash[Array[String], Analysis], Array[Array[String]]]

Returns:

  • ([ Hash[Array[String], Analysis], Array[Array[String]] ])


27
28
29
# File 'lib/paper_trail_diff/scoped_analysis.rb', line 27

def to_ary
  [analyses, unreachable]
end