<commit_before>module Skellington
  class Template
    def initialize name, generator
      @name = name
      @generator = generator
    end

    def outpath
      @outpath ||= begin
        subs = @generator.files[@name]['outpath'].split '/'
        @outpath = "#{@generator.path}/#{@name.sub(subs[0], @generator.path)}"
      rescue NoMethodError
        @outpath = "#{@generator.path}/#{@name}"
      end
    end

    def templates_dir
      File.join File.dirname(__FILE__), '..', 'templates'
    end

    def write
      print "Generating #{outpath}..."
      FileUtils.mkdir_p File.dirname outpath
      f = File.open outpath, 'w'
      f.write self
      f.close
      puts 'done'
    end

    def to_s<commit_msg>Makes more sense now it's YAML-driven<commit_after>module Skellington
  class Template
    def initialize name, generator
      @name = name
      @generator = generator
    end

    def outpath
      @outpath ||= begin
        subs = @generator.files[@name]['outpath'].split '/'
        @outpath = "#{@generator.send(subs[1].to_sym)}/#{@name.sub(subs[0], @generator.send(subs[1].to_sym))}"
      rescue NoMethodError
        @outpath = "#{@generator.path}/#{@name}"
      end
    end

    def templates_dir
      File.join File.dirname(__FILE__), '..', 'templates'
    end

    def write
      print "Generating #{outpath}..."
      FileUtils.mkdir_p File.dirname outpath
      f = File.open outpath, 'w'
      f.write self
      f.close
      puts 'done'
    end

    def to_s
{'fraction_non_alphanumeric': 0.132, 'fraction_numerical': 0.0026666666666666666, 'mean_word_length': 2.328159645232816, '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': '3921531', 'n_tokens_mistral': 484, 'n_tokens_neox': 477, 'n_words': 112}