<commit_before>##
# Provides assistance when dealing with a fixture.
#
class FixtureHelper
  FIXTURES_DIR = Pathname.new(__FILE__).dirname + '../fixtures'

  attr_reader :root, :project

  def initialize(fixture_name = :default)
    @root = Dir.mktmpdir

    # Copy the fixture to a temporary location.
    files = (Dir[FIXTURES_DIR + "#{fixture_name}/*"] +
             Dir[FIXTURES_DIR + "#{fixture_name}/**/*"]).uniq

    FileUtils.cp_r(files, @root)

    reload!
  end

  # Updates montage.yml with new contents.
  def replace_config(config)
    File.open(@project.paths.config, 'w') { |f| f.puts(config) }
  end

  # Replaces an image file.<commit_msg>Ruby 1.9.1 fix.<commit_after>##
# Provides assistance when dealing with a fixture.
#
class FixtureHelper
  FIXTURES_DIR = Pathname.new(__FILE__).dirname + '../fixtures'

  attr_reader :root, :project

  def initialize(fixture_name = :default)
    @root = Dir.mktmpdir

    # Copy the fixture to a temporary location.
    files = (Dir[(FIXTURES_DIR + "#{fixture_name}/*").to_s] +
             Dir[(FIXTURES_DIR + "#{fixture_name}/**/*").to_s]).uniq

    FileUtils.cp_r(files, @root)

    reload!
  end

  # Updates montage.yml with new contents.
  def replace_config(config)
    File.open(@project.paths.config, 'w') { |f| f.puts(config) }
  end

  # Replaces an image file.
{'fraction_non_alphanumeric': 0.13909774436090225, 'fraction_numerical': 0.002255639097744361, 'mean_word_length': 3.4072847682119205, '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': '1313992', 'n_tokens_mistral': 486, 'n_tokens_neox': 456, 'n_words': 107}