Module: StillActive::TerminalHelper

Extended by:
TerminalHelper
Included in:
TerminalHelper
Defined in:
lib/helpers/terminal_helper.rb

Constant Summary collapse

HEADERS =
["Name", "Version", "Activity", "OpenSSF", "Vulns", "License"].freeze

Instance Method Summary collapse

Instance Method Details

#render(result, ruby_info: nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/helpers/terminal_helper.rb', line 15

def render(result, ruby_info: nil)
  rows = result.keys.sort.map { |name| build_row(name, result[name]) }
  widths = column_widths(rows)

  lines = []
  lines << header_line(widths)
  lines << separator_line(widths)
  rows.each { |row| lines << row_line(row, widths) }
  lines << ""
  lines << summary_line(result)
  lines << ruby_summary_line(ruby_info) if ruby_info
  lines.join("\n")
end