lib/exporter/local_authority_exporter.rb
def write_headers_and_data_to_export_file
    puts "Adding headers to data from temp file..."
    CSV.open(export_file, "w") do |csv|
      csv << headers
      CSV.foreach(temp_file) { |row| csv << row }
    end
  end
# We don't know how many headers we'll need until after we
# process all the fedora objects, so we need to add the
# headers to the file after the data has been written.
# In ruby there doesn't seem to be a nice way to prepend one
# line to a file, so we write the headers to a new file and
# then append the data from the temp file.
We don't know how many headers we'll need until after we
process all the fedora objects, so we need to add the
headers to the file after the data has been written.
In ruby there doesn't seem to be a nice way to prepend one
line to a file, so we write the headers to a new file and
then append the data from the temp file.
We don ' t know how many headers we ' ll need until after we process all the fedora objects so we need to add the headers to the file after the data has been written . In ruby there doesn ' t seem to be a nice way to prepend one line to a file so we write the headers to a new file and then append the data from the temp file .
def write_headers_and_data_to_export_file
    puts "Adding headers to data from temp file..."
    CSV.open(export_file, "w") do |csv|
      csv << headers
      CSV.foreach(temp_file) { |row| csv << row }
    end
  end
def write_headers_and_data_to_export_file puts "Adding headers to data from temp file..." CSV . open ( export_file , "w" ) do | csv | csv << headers CSV . foreach ( temp_file ) { | row | csv << row } end end
We don't know how many headers we'll need until after we
process all the fedora objects, so we need to add the
headers to the file after the data has been written.
We don ' t know how many headers we ' ll need until after we process all the fedora objects so we need to add the headers to the file after the data has been written .