<commit_before>require 'gast'

module Gast
  class Memo
    def self.save(content, language = 'no-highlight')
      @repo = Gast::Repository.new
      @repo.create
      @repo.content = CGI.unescapeHTML(content.to_s)
      @repo.language = CGI.unescapeHTML(language.to_s)
      @repo.publish
      @repo.commit!
      {
        content_id: @repo.dir_name,
        language: language
      }
    end

    def self.update(content_id, content, language = 'no-highlight')
      return content_id if content.to_s.chomp == item(content_id).chomp
      @repo = Gast::Repository.new
      @repo.dir_name = content_id
      @repo.create
      @repo.content = CGI.unescapeHTML(content.to_s)
      @repo.language = CGI.unescapeHTML(language.to_s)
      @repo.publish
      @repo.commit!
      {
        content_id: @repo.dir_name,
        language: language
      }
    end

    def self.number
      lists.length
    end

    def self.lists
      Dir.glob(File.expand_path(Gast::PATH + '/**')).map do |dir|
        dir.split('/').last
      end
    end

    def self.item(id)
      CGI.escapeHTML(
        File.read(File.expand_path(Gast::PATH + "/#{id}/content"))
      )
    end

    def self.language(id)
      CGI.escapeHTML(
        File.read(File.expand_path(Gast::PATH + "/#{id}/language"))
      )
    end

    def initialize; end
  end
end
<commit_msg>Modified: Rename method of the publish. new name is write.<commit_after>require 'gast'

module Gast
  class Memo
    def self.save(content, language = 'no-highlight')
      @repo = Gast::Repository.new
      @repo.create
      @repo.content = CGI.unescapeHTML(content.to_s)
      @repo.language = CGI.unescapeHTML(language.to_s)
      @repo.write
      @repo.commit!
      {
        content_id: @repo.dir_name,
        language: language
      }
    end

    def self.update(content_id, content, language = 'no-highlight')
      return content_id if content.to_s.chomp == item(content_id).chomp
      @repo = Gast::Repository.new
      @repo.dir_name = content_id
      @repo.create
      @repo.content = CGI.unescapeHTML(content.to_s)
      @repo.language = CGI.unescapeHTML(language.to_s)
      @repo.write
      @repo.commit!
      {
        content_id: @repo.dir_name,
        language: language
      }
    end

    def self.number
      lists.length
    end

    def self.lists
      Dir.glob(File.expand_path(Gast::PATH + '/**')).map do |dir|
        dir.split('/').last
      end
    end

    def self.item(id)
      CGI.escapeHTML(
        File.read(File.expand_path(Gast::PATH + "/#{id}/content"))
      )
    end

    def self.language(id)
      CGI.escapeHTML(
        File.read(File.expand_path(Gast::PATH + "/#{id}/language"))
      )
    end

    def initialize; end
  end
end

{'fraction_non_alphanumeric': 0.12504557054320087, 'fraction_numerical': 0.0, 'mean_word_length': 2.220657276995305, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4285751', 'n_tokens_mistral': 927, 'n_tokens_neox': 930, 'n_words': 169}