Class: LicenseFinder::CsvReport
- Defined in:
- lib/license_finder/reports/csv_report.rb
Direct Known Subclasses
Constant Summary collapse
- COMMA_SEP =
','.freeze
- NEWLINE_SEP =
'\@NL'.freeze
- AVAILABLE_COLUMNS =
%w[name version authors licenses license_links approved summary description homepage install_path package_manager groups texts notice].freeze
- MISSING_DEPENDENCY_TEXT =
'This package is not installed. Please install to determine licenses.'.freeze
Instance Method Summary collapse
-
#initialize(dependencies, options) ⇒ CsvReport
constructor
A new instance of CsvReport.
- #to_s ⇒ Object
Methods inherited from Report
Constructor Details
#initialize(dependencies, options) ⇒ CsvReport
Returns a new instance of CsvReport.
10 11 12 13 14 15 |
# File 'lib/license_finder/reports/csv_report.rb', line 10 def initialize(dependencies, ) super [:columns] ||= %w[name version licenses] @columns = Array([:columns]) & self.class::AVAILABLE_COLUMNS @write_headers = [:write_headers] || false end |
Instance Method Details
#to_s ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/license_finder/reports/csv_report.rb', line 17 def to_s CSV.generate(col_sep: self.class::COMMA_SEP, headers: @columns, write_headers: @write_headers) do |csv| sorted_dependencies.each do |s| csv << format_dependency(s) end end end |