Class: ADLicenseLint::TerminalFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/ad_licenselint/terminal_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(report) ⇒ TerminalFormatter

Returns a new instance of TerminalFormatter.



4
5
6
# File 'lib/ad_licenselint/terminal_formatter.rb', line 4

def initialize(report)
  @report = report
end

Instance Method Details

#formatted_contentObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ad_licenselint/terminal_formatter.rb', line 8

def formatted_content
  rows = @report
    .entries
    .sort_by(&:pod_name)
    .map { |entry|
      [entry.pod_name, entry.license_name, entry.source_url]
    }
  Terminal::Table.new({
    headings: ['Pod', 'License', 'Source'],
    rows: rows
  }).to_s
end