<commit_before>require 'git_hook'

module GitHook
  class DSL
    def self.eval(hooks_file)
      env = new
      env.load(hooks_file)
      env
    end

    def initialize
      @hooks = {}
      @with_bundler = false
    end
    attr_reader :hooks, :with_bundler

    def with_bundler!
      @with_bundler = true
    end

    # @param [String, Symbol, Class] name
    # @param [Symbol] timing GitHook::Timings
    # @param [Hash] options
    # @option options [String] gem require path
    def hook(name, timing, options = {})
      timing = timing.to_s.to_sym
      options = options || {}
      @hooks[timing] = [] if @hooks[timing].nil?

      obj = GitHook::Hook.resolve(name)
      obj[:require] = options[:require] if options[:require]
      Kernel.instance_eval do
        require obj[:require]
      end
      obj[:class] = obj[:class].to_s.split('::').inject(Kernel){|namespace, klass|
        namespace.const_get(klass)
      }
      obj[:options] = options

      @hooks[timing].push(obj)
    end

    GitHook::TIMINGS.each do | timing |<commit_msg>dsl fix<commit_after>require 'git_hook'

module GitHook
  class DSL
    def self.eval(hooks_file)
      env = new
      env.load(hooks_file)
      env
    end

    def initialize
      @hooks = {}
      @with_bundler = false
    end
    attr_reader :hooks, :with_bundler

    def with_bundler!
      @with_bundler = true
    end

    # @param [String, Symbol, Class] name
    # @param [Symbol] timing GitHook::Timings
    # @param [Hash] options
    # @option options [String] gem require path
    def hook(name, timing, options = {})
      timing = timing.to_s.to_sym
      options = options || {}
      @hooks[timing] = [] if @hooks[timing].nil?

      obj = GitHook::Hook.resolve(name)
      obj[:require] = options[:require] if options[:require]
      Kernel.instance_eval do
        begin
          require obj[:require]
        rescue LoadError
        end
      end
      obj[:class] = obj[:class].to_s.split('::').inject(Kernel){|namespace, klass|
        namespace.const_get(klass)
      }
      obj[:options] = options

      @hooks[timing].push(obj)
    end

    GitHook::TIMINGS.each do | timing |
{'fraction_non_alphanumeric': 0.12068171349608475, 'fraction_numerical': 0.0, 'mean_word_length': 2.4696485623003195, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4469479', 'n_tokens_mistral': 696, 'n_tokens_neox': 702, 'n_words': 161}