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



13
14
15
16
17
18
# File 'lib/reviewer/setup/detector.rb', line 13

Result = Struct.new(:key, :reasons, 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
  # @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



13
14
15
16
17
18
# File 'lib/reviewer/setup/detector.rb', line 13

Result = Struct.new(:key, :reasons, 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
  # @return [String] formatted line for display (name + reasons)
  def summary = "  #{name.ljust(22)}#{reasons.join(', ')}"
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



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

def name = Catalog.config_for(key)&.dig(:name) || key.to_s
# @return [String] formatted line for display (name + reasons)

#summaryString

Returns formatted line for display (name + reasons).

Returns:

  • (String)

    formatted line for display (name + reasons)



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

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