Class: RiskRegistryPage

Inherits:
BaseDocument show all
Includes:
RpnRendering
Defined in:
lib/almirah/doc_types/risk_registry_page.rb

Overview

The registry page (ADR-216): build/risks//overview.html holding the rendered registry preface (overview.md), when present, followed by the register table — one row per risk record with the implicit linked-ID and Title columns first, then the configured columns filled from each record's section matched by heading text. The Status column is reserved: it is filled from the record's current lifecycle status, never from a section.

Constant Summary collapse

STATUS_COLUMN =
'Status'
AFFECTED_DOCUMENTS_COLUMN =

The column rendered as bare linked IDs from the record's Affected Documents section (ADR-218), never as the section's prose.

'Affected Documents'

Instance Attribute Summary collapse

Attributes inherited from BaseDocument

#dom, #headings, #id, #output_rel_path, #title

Instance Method Summary collapse

Methods included from RpnRendering

#format_rpn, #rpn_threshold_class

Methods inherited from BaseDocument

#decisions_link, #home_link, #index_link, #needs_chartjs?, #rel_to, #risks_link, #save_html_to_file

Constructor Details

#initialize(registry, records, preface, columns, rpn_groups = []) ⇒ RiskRegistryPage

columns is the configured per-registry list (ADR-216); nil means the registry is not configured and gets the implicit columns plus Status only. rpn_groups (ADR-217) appends one computed " RPN" column per group after the configured columns; empty appends nothing.



27
28
29
30
31
32
33
34
35
36
# File 'lib/almirah/doc_types/risk_registry_page.rb', line 27

def initialize(registry, records, preface, columns, rpn_groups = [])
  super()
  @registry = registry
  @records = records
  @preface = preface
  @columns = columns.nil? ? [STATUS_COLUMN] : columns
  @rpn_groups = rpn_groups
  @id = 'overview'
  @title = preface_title || "Risk Registry: #{registry}"
end

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



21
22
23
# File 'lib/almirah/doc_types/risk_registry_page.rb', line 21

def columns
  @columns
end

#prefaceObject

Returns the value of attribute preface.



21
22
23
# File 'lib/almirah/doc_types/risk_registry_page.rb', line 21

def preface
  @preface
end

#recordsObject

Returns the value of attribute records.



21
22
23
# File 'lib/almirah/doc_types/risk_registry_page.rb', line 21

def records
  @records
end

#registryObject

Returns the value of attribute registry.



21
22
23
# File 'lib/almirah/doc_types/risk_registry_page.rb', line 21

def registry
  @registry
end

#rpn_groupsObject

Returns the value of attribute rpn_groups.



21
22
23
# File 'lib/almirah/doc_types/risk_registry_page.rb', line 21

def rpn_groups
  @rpn_groups
end

Instance Method Details

#to_consoleObject



38
39
40
# File 'lib/almirah/doc_types/risk_registry_page.rb', line 38

def to_console
  puts "\e[36mRisk Registry: #{@registry}\e[0m"
end

#to_html(output_file_path) ⇒ Object



42
43
44
45
46
47
# File 'lib/almirah/doc_types/risk_registry_page.rb', line 42

def to_html(output_file_path)
  html_rows = ['']
  html_rows.concat preface_html
  html_rows.append render_register_table
  save_html_to_file(html_rows, nil, output_file_path)
end