<commit_before>module OptimusPrime
  module Transformers
    class RenameKey < Destination
      # This class accepts a hash object and replaces incorrect
      # keys with correct ones based on the mapping hash given
      # in the initializer.

      def initialize(mapper:)
        @mapper = mapper
      end

      def write(record)
        push transform(record)
      end

      private
      def transform(record)
        record.keys.each do |field|
          next unless @mapper.include?(field)
          record[@mapper[field]] ||= record[field]
          record.delete field
        end
        record
      end
    end
  end
end<commit_msg>added linebreak<commit_after>module OptimusPrime
  module Transformers
    class RenameKey < Destination
      # This class accepts a hash object and replaces incorrect
      # keys with correct ones based on the mapping hash given
      # in the initializer.

      def initialize(mapper:)
        @mapper = mapper
      end

      def write(record)
        push transform(record)
      end

      private

      def transform(record)
        record.keys.each do |field|
          next unless @mapper.include?(field)
          record[@mapper[field]] ||= record[field]
          record.delete field
        end
        record
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.059861857252494245, 'fraction_numerical': 0.0, 'mean_word_length': 2.0396270396270397, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3621332', 'n_tokens_mistral': 350, 'n_tokens_neox': 336, 'n_words': 116}