<commit_before>module MagicLamp
  MAGIC_LAMP = "magic_lamp"
  SPEC = "spec"
  TEST = "test"
  TMP = "tmp"
  TMP_PATH = [TMP, MAGIC_LAMP]

  class << self
    attr_writer :path

    def path
      path = @path || default_path
      Rails.root.join(*path)
    end

    def default_path
      [directory_path, MAGIC_LAMP]
    end

    def create_fixture(fixture_name, controller_class, &block)
      FixtureCreator.new.create_fixture(fixture_name, controller_class, &block)
    end

    def clear_fixtures
      FixtureCreator.new.remove_tmp_directory
    end

    def load_config
      Dir[Rails.root.join(directory_path, "**", "magic_lamp.rb")].each { |f| require f }
    end

    private

    def directory_path
      Dir.exist?(Rails.root.join(SPEC)) ? SPEC : TEST
    end
  end
end

require "magic_lamp/fixture_creator"<commit_msg>minor refactor to use constant<commit_after>module MagicLamp
  MAGIC_LAMP = "magic_lamp"
  SPEC = "spec"
  TEST = "test"
  TMP = "tmp"
  TMP_PATH = [TMP, MAGIC_LAMP]

  class << self
    attr_writer :path

    def path
      path = @path || default_path
      Rails.root.join(*path)
    end

    def default_path
      [directory_path, MAGIC_LAMP]
    end

    def create_fixture(fixture_name, controller_class, &block)
      FixtureCreator.new.create_fixture(fixture_name, controller_class, &block)
    end

    def clear_fixtures
      FixtureCreator.new.remove_tmp_directory
    end

    def load_config
      Dir[Rails.root.join(directory_path, "**", "#{MAGIC_LAMP}.rb")].each { |f| require f }
    end

    private

    def directory_path
      Dir.exist?(Rails.root.join(SPEC)) ? SPEC : TEST
    end
  end
end

require "magic_lamp/fixture_creator"
{'fraction_non_alphanumeric': 0.09786476868327403, 'fraction_numerical': 0.0, 'mean_word_length': 3.0262529832935563, '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': '6768435', 'n_tokens_mistral': 630, 'n_tokens_neox': 601, 'n_words': 123}