<commit_before>module Generator
  # Contains methods accessible to the ERB template
  class TemplateValues
    attr_reader :abbreviated_commit_hash, :version, :test_cases

    def initialize(abbreviated_commit_hash:, version:, test_cases:)
      @abbreviated_commit_hash = abbreviated_commit_hash
      @version = version
      @test_cases = test_cases
    end

    def get_binding
      binding
    end
  end

  module TemplateValuesFactory
    def template_values
      # These are needed by the 'ExerciseCases' classes
      # TODO: move these into the individual classes
      require 'ostruct'
      require 'json'
      require cases_require_name

      TemplateValues.new(
        abbreviated_commit_hash: canonical_data.abbreviated_commit_hash,
        version: version,
        test_cases: test_cases_proc.call(canonical_data.to_s)
      )
    end

    private

    def cases_require_name
      Files::GeneratorCases.filename(exercise_name)
    end

    def test_cases_proc
      Object.const_get(Files::GeneratorCases.proc_name(exercise_name))
    end
  end
end
<commit_msg>Remove requires that should be in cases files.<commit_after>module Generator
  # Contains methods accessible to the ERB template
  class TemplateValues
    attr_reader :abbreviated_commit_hash, :version, :test_cases

    def initialize(abbreviated_commit_hash:, version:, test_cases:)
      @abbreviated_commit_hash = abbreviated_commit_hash
      @version = version
      @test_cases = test_cases
    end

    def get_binding
      binding
    end
  end

  module TemplateValuesFactory
    def template_values
      require cases_require_name

      TemplateValues.new(
        abbreviated_commit_hash: canonical_data.abbreviated_commit_hash,
        version: version,
        test_cases: test_cases_proc.call(canonical_data.to_s)
      )
    end

    private

    def cases_require_name
      Files::GeneratorCases.filename(exercise_name)
    end

    def test_cases_proc
      Object.const_get(Files::GeneratorCases.proc_name(exercise_name))
    end
  end
end

{'fraction_non_alphanumeric': 0.051783097215437224, 'fraction_numerical': 0.0, 'mean_word_length': 3.311578947368421, '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': '6063858', 'n_tokens_mistral': 625, 'n_tokens_neox': 586, 'n_words': 137}