class LicenseScout::Exporter

Attributes

export_format[R]
exporter[R]
json_file[R]

Public Class Methods

new(json_file, export_format) click to toggle source
# File lib/license_scout/exporter.rb, line 27
def initialize(json_file, export_format)
  @json_file = json_file
  @export_format = export_format

  @exporter = case export_format
              when "csv"
                LicenseScout::Exporter::CSV.new(json_file)
              else
                # We shouldn't ever hit this, because the CLI filters out unsupported formats. But just in case...
                raise LicenseScout::Exceptions::UnsupportedExporter.new("'#{export_format}' is not a supported format. Please use one of the following: #{supported_formats.join(", ")}")
              end
end
supported_formats() click to toggle source
# File lib/license_scout/exporter.rb, line 40
def self.supported_formats
  [
    "csv",
  ]
end

Public Instance Methods

export() click to toggle source
# File lib/license_scout/exporter.rb, line 46
def export
  LicenseScout::Log.info("[exporter] Exporting #{json_file} to '#{export_format}'")
  exporter.export
end