<commit_before>module Approvals

  class Dotfile
    class << self

      def reset
        File.delete(path) if File.exists?(path)
        touch
      end

      def path
        File.join(Approvals.project_dir, '.approvals')
      end

      def touch
        FileUtils.touch(path)
      end

      def append(text)
        unless includes?(text)
          write text
        end
      end

      def includes?(text)
        system("cat #{path} | grep -q \"^#{text}$\"")
      end

      def write(text)
        File.open(path, 'a+') do |f|
          f.write "#{text}\n"
        end
      end

    end
  end

end<commit_msg>Used a truncate instead of delete-touch combo, to empty  file. (+boyscout)<commit_after>module Approvals

  class Dotfile
    class << self

      def reset
        File.truncate(path, 0) if File.exists?(path)
      end

      def append(text)
        unless includes?(text)
          write text
        end
      end

      private

      def path
        File.join(Approvals.project_dir, '.approvals')
      end

      def includes?(text)
        system("cat #{path} | grep -q \"^#{text}$\"")
      end

      def write(text)
        File.open(path, 'a+') do |f|
          f.write "#{text}\n"
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10952380952380952, 'fraction_numerical': 0.0007936507936507937, 'mean_word_length': 1.6053719008264462, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3932976', 'n_tokens_mistral': 409, 'n_tokens_neox': 388, 'n_words': 108}