<commit_before>require 'algerb/util'

module Algerb; end
class Algerb::Generator
  include Algerb::Util

  def generate(files)
    files = files.map {|file| file.sub(/\.rb$/, '') }

    result = <<-__E_O_F__
class Autoloader
  def self.register
    Object.module_eval <<-__EOF__
    __E_O_F__

    result += generate_autoload_body(files)

    result += <<-__E_O_F__
    __EOF__
  end
end
    __E_O_F__
    result
  end

  def generate_autoload_body(files)
    files.map do |file|
      "      autoload :#{file_to_class(file)}, '#{file}'"
    end.join("\n") + "\n"
  end
end
<commit_msg>Refactoring.<commit_after>require 'algerb/util'

module Algerb; end
class Algerb::Generator
  include Algerb::Util

  def generate(files)
    files = files.map {|file| file.sub(/\.rb$/, '') }

    result = <<-__E_O_F__
class Autoloader
  def self.register
    Object.module_eval <<-__EOF__
    __E_O_F__

    result += generate_autoloader_body(files).split("\n").map{|line| '      ' + line }.join("\n") + "\n"

    result += <<-__E_O_F__
    __EOF__
  end
end
    __E_O_F__
    result
  end

  def generate_autoloader_body(files)
    files.map do |file|
      "autoload :#{file_to_class(file)}, '#{file}'"
    end.join("\n") + "\n"
  end
end

{'fraction_non_alphanumeric': 0.1457654723127036, 'fraction_numerical': 0.0, 'mean_word_length': 3.0427631578947367, 'pattern_counts': {'":': 0, '<': 15, '<?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': '6503713', 'n_tokens_mistral': 494, 'n_tokens_neox': 478, 'n_words': 95}