class Unused::Reporters::CSVReporter

Constants

HEADERS

Public Class Methods

new(instance_methods, class_methods, map) click to toggle source
# File lib/unused/reporters/csv_reporter.rb, line 11
def initialize(instance_methods, class_methods, map)
  @instance_methods = instance_methods
  @class_methods = class_methods
  @map = map
end

Public Instance Methods

report() click to toggle source
# File lib/unused/reporters/csv_reporter.rb, line 17
def report
  CSV.open(
    Unused.config.output_file,
    'w',
    headers: HEADERS,
    write_headers: true
  ) do |csv|
    ordered_methods.each do |method|
      csv << [
        method.representation,
        method.owner,
        method.id,
        method.type,
        method.calls,
        method.source
      ]
    end
  end
end

Private Instance Methods

ordered_methods() click to toggle source
# File lib/unused/reporters/csv_reporter.rb, line 39
def ordered_methods
  method_summary.sort_by!(&:calls)
end