lib/csv_report_generator.rb
def generate_report
    CSV.generate(write_headers: false, headers: headers) do |csv|
      # Don't want to rely on `write_headers: true` since we want still
      # header row in the CSV file even when there is no data.
      csv << headers
      records.each do |record|
        csv << method_names.map { |method_name| record.public_send method_name }
      end
    end
  end
# Generates a report with the given configuration
#
# @return [CSV]
Generates a report with the given configuration
Generates a report with the given configuration
def generate_report
    CSV.generate(write_headers: false, headers: headers) do |csv|
      csv << headers
      records.each do |record|
        csv << method_names.map { |method_name| record.public_send method_name }
      end
    end
  end
def generate_report CSV . generate ( write_headers : false , headers : headers ) do | csv | csv << headers records . each do | record | csv << method_names . map { | method_name | record . public_send method_name } end end end
Generates a report with the given configuration
Generates a report with the given configuration
# Don't want to rely on `write_headers: true` since we want still # header row in the CSV file even when there is no data.
None
CSV