<commit_before>module EmailTemplate
  class Template
    attr_accessor :file, :mailer, :template, :html

    def initialize(file, mailer)
      @file = File.new(EmailTemplate.template_path(mailer) + file)
      @mailer = mailer
    end

    def template
      @template ||= file.read.to_s
    end

    def dynamic_elements
      template.scan(/(\#\{.*?\})/).flatten
    end

    def safe_template
      temp = template.dup
      temp.gsub!(/\s@[a-z]*/, "::EmailTemplate::NullObject.new")
      dynamic_elements.each do |element|
        temp.gsub!(element, "{{VARIABLE}}")
      end
      temp
    end

    def to_html<commit_msg>Ensure that #'s don't translate into interpolation<commit_after>module EmailTemplate
  class Template
    attr_accessor :file, :mailer, :template, :html

    def initialize(file, mailer)
      @file = File.new(EmailTemplate.template_path(mailer) + file)
      @mailer = mailer
    end

    def template
      @template ||= file.read.to_s
    end

    def dynamic_elements
      template.scan(/(\#\{.*?\})/).flatten
    end

    def safe_template
      temp = template.dup
      dynamic_elements.each do |element|
        temp.gsub!(element, "{{VARIABLE}}")
      end
      temp.gsub!(/\s@[a-z]*/, "::EmailTemplate::NullObject.new")
      temp.gsub!(/#/, "# ")
      temp
    end

    def to_html
{'fraction_non_alphanumeric': 0.13584905660377358, 'fraction_numerical': 0.0, 'mean_word_length': 2.5549597855227884, 'pattern_counts': {'":': 2, '<': 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': '4307806', 'n_tokens_mistral': 442, 'n_tokens_neox': 428, 'n_words': 92}