<commit_before>require "execjs"

module DoT
  module Source
    def self.path
      @path = File.expand_path('../../vendor/assets/javascripts/doT.js', __FILE__)
    end

    def self.path=(path)
      @contents = @version = @context = nil
      @path = path
    end

    def self.contents
      @contents ||= File.read(path)
    end

    def self.context
      @context ||= ExecJS.compile(contents)
    end
  end

  class << self
    def compile(template)
      template = template.read if template.respond_to?(:read)
      Source.context.call("doT.precompile", template)
    end

    def context_for(template)
      ExecJS.compile("var render = #{compile(template)}")
    end

    def render(template, locals = {})
      context_for(template).call("render", locals)
    end
  end
end
<commit_msg>fix source path<commit_after>require "execjs"

module DoT
  module Source
    def self.path
      @path = File.expand_path('../../../vendor/assets/javascripts/doT.js', __FILE__)
    end

    def self.path=(path)
      @contents = @version = @context = nil
      @path = path
    end

    def self.contents
      @contents ||= File.read(path)
    end

    def self.context
      @context ||= ExecJS.compile(contents)
    end
  end

  class << self
    def compile(template)
      template = template.read if template.respond_to?(:read)
      Source.context.call("doT.precompile", template)
    end

    def context_for(template)
      ExecJS.compile("var render = #{compile(template)}")
    end

    def render(template, locals = {})
      context_for(template).call("render", locals)
    end
  end
end

{'fraction_non_alphanumeric': 0.12445278298936835, 'fraction_numerical': 0.0, 'mean_word_length': 2.6199095022624435, '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': '63956', 'n_tokens_mistral': 506, 'n_tokens_neox': 491, 'n_words': 116}