Class: Snoot::AnalyseRun::Decision

Inherits:
Object
  • Object
show all
Defined in:
lib/snoot/analyse_run/decision.rb

Overview

Internal collaborator: bundles an AnalyserOrchestration with the Sources it produced so the chained selection helpers can share both as state instead of threading the pair through every call.

Instance Method Summary collapse

Constructor Details

#initialize(orchestration:, sources:) ⇒ Decision

Returns a new instance of Decision.



9
10
11
12
# File 'lib/snoot/analyse_run/decision.rb', line 9

def initialize(orchestration:, sources:)
  @orchestration = orchestration
  @sources = sources
end

Instance Method Details

#resolve(run) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/snoot/analyse_run/decision.rb', line 14

def resolve(run)
  selected = selected_candidate
  terminal = if selected
               run.transition_to(:finding_rendered, selected_finding: selected)
             else
               run.transition_to(:nothing_to_report)
             end
  Result.new(run: terminal, events: doc_less_events(terminal), smells: @sources.smells)
end