<commit_before>module CanBeSerializedToCsv
  extend ActiveSupport::Concern

  included do
    def self.to_csv
      CSV.generate do |csv|
        csv << (respond_to?(:csv_column_names) ? csv_column_names : column_names)
        find_each do |model|
          csv << (model.respond_to?(:csv_row_values) ? model.csv_row_values : model.attributes.values_at(*column_names))
        end
      end
    end
  end
end
<commit_msg>Add require csv to CanBeSerializedToCSV.<commit_after>require 'csv'

module CanBeSerializedToCsv
  extend ActiveSupport::Concern

  included do
    def self.to_csv
      CSV.generate do |csv|
        csv << (respond_to?(:csv_column_names) ? csv_column_names : column_names)
        find_each do |model|
          csv << (model.respond_to?(:csv_row_values) ? model.csv_row_values : model.attributes.values_at(*column_names))
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.08916478555304741, 'fraction_numerical': 0.0, 'mean_word_length': 3.2440191387559807, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7312643', 'n_tokens_mistral': 300, 'n_tokens_neox': 288, 'n_words': 60}