Class: Reviewer::Setup::Detector::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/reviewer/setup/detector.rb

Overview

Value object for a single detection result (tool key + evidence).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keySymbol

Returns the tool identifier from the catalog.

Returns:

  • (Symbol)

    the tool identifier from the catalog



29
30
31
32
33
34
35
# File 'lib/reviewer/setup/detector.rb', line 29

Result = Struct.new(:key, :sources, keyword_init: true) do
  # @return [String] human-readable tool name from the catalog, or the key as fallback
  def name = Catalog.config_for(key)&.dig(:name) || key.to_s
  def reasons = sources.map(&:description)
  # @return [String] formatted line for display (name + reasons)
  def summary = "  #{name.ljust(22)}#{reasons.join(', ')}"
end

#reasonsArray<String>

Returns evidence strings explaining why the tool was detected.

Returns:

  • (Array<String>)

    evidence strings explaining why the tool was detected



29
30
31
32
33
34
35
# File 'lib/reviewer/setup/detector.rb', line 29

Result = Struct.new(:key, :sources, keyword_init: true) do
  # @return [String] human-readable tool name from the catalog, or the key as fallback
  def name = Catalog.config_for(key)&.dig(:name) || key.to_s
  def reasons = sources.map(&:description)
  # @return [String] formatted line for display (name + reasons)
  def summary = "  #{name.ljust(22)}#{reasons.join(', ')}"
end

#sourcesObject

Returns the value of attribute sources

Returns:

  • (Object)

    the current value of sources



29
30
31
# File 'lib/reviewer/setup/detector.rb', line 29

def sources
  @sources
end

Instance Method Details

#nameString

Returns human-readable tool name from the catalog, or the key as fallback.

Returns:

  • (String)

    human-readable tool name from the catalog, or the key as fallback



31
# File 'lib/reviewer/setup/detector.rb', line 31

def name = Catalog.config_for(key)&.dig(:name) || key.to_s

#summaryString

Returns formatted line for display (name + reasons).

Returns:

  • (String)

    formatted line for display (name + reasons)



34
# File 'lib/reviewer/setup/detector.rb', line 34

def summary = "  #{name.ljust(22)}#{reasons.join(', ')}"