Class: Insika::Doctor::DomainReport

Inherits:
Data
  • Object
show all
Defined in:
lib/insika/doctor.rb

Overview

The domain section of the doctor: the E2 proof surface. Read-only and informational — it never fails the exit code (a pilot reporting its own artifacts exits 0).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#entriesObject (readonly)

Returns the value of attribute entries

Returns:

  • (Object)

    the current value of entries



74
75
76
# File 'lib/insika/doctor.rb', line 74

def entries
  @entries
end

#gem_versionObject (readonly)

Returns the value of attribute gem_version

Returns:

  • (Object)

    the current value of gem_version



74
75
76
# File 'lib/insika/doctor.rb', line 74

def gem_version
  @gem_version
end

#generated_atObject (readonly)

Returns the value of attribute generated_at

Returns:

  • (Object)

    the current value of generated_at



74
75
76
# File 'lib/insika/doctor.rb', line 74

def generated_at
  @generated_at
end

Instance Method Details

#countObject



76
# File 'lib/insika/doctor.rb', line 76

def count  = entries.length

#empty?Boolean

Returns:

  • (Boolean)


75
# File 'lib/insika/doctor.rb', line 75

def empty? = entries.empty?

#to_hObject



78
79
80
81
# File 'lib/insika/doctor.rb', line 78

def to_h
  { "generated_at" => generated_at, "gem_version" => gem_version,
    "count" => count, "entries" => entries.map(&:to_h) }
end

#to_sObject

The human section (prints AFTER the findings — a section, not a finding).



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/insika/doctor.rb', line 84

def to_s
  header =
    if count.zero?
      "domain: 0 artifacts — a bare install declares no store and ships no corpus in use"
    else
      "domain: #{count} artifact(s) — declared by the deployment or inherited from the gem default"
    end
  lines = entries.map do |e|
    agent = e.agent ? "#{e.agent}: " : ""
    source = e.source ? " (#{e.source})" : ""
    clear = e.how_to_clear ? " — clear: #{e.how_to_clear}" : ""
    "  [#{e.kind}] #{agent}#{e.detail}#{source}#{clear}"
  end
  ([header] + lines).join("\n")
end