<commit_before>require 'cap-util/timer'

module CapUtil

  def self.time(timer_set, name, &block)
    timer_set[name] = CapUtil::Timer.new(name)
    if !block.nil?
      begin
        timer_set[name].start
        block.call
      ensure
        timer_set[name].end
      end
    end
    timer_set[name]
  end

  module Time

    def self.included(receiver)
      receiver.send(:extend,  TimeMethods)
      receiver.send(:include, TimeMethods)
    end

    module TimeMethods
      def time(*args, &block); CapUtil.time(*args, &block); end
    end

  end
end
<commit_msg>fixed a bug where the timers were always getting overriden using the `time` helper<commit_after>require 'cap-util/timer'

module CapUtil

  def self.time(timer_set, name, &block)
    timer_set[name] ||= CapUtil::Timer.new(name)
    if !block.nil?
      begin
        timer_set[name].start
        block.call
      ensure
        timer_set[name].end
      end
    end
    timer_set[name]
  end

  module Time

    def self.included(receiver)
      receiver.send(:extend,  TimeMethods)
      receiver.send(:include, TimeMethods)
    end

    module TimeMethods
      def time(*args, &block); CapUtil.time(*args, &block); end
    end

  end
end

{'fraction_non_alphanumeric': 0.10057708161582853, 'fraction_numerical': 0.0, 'mean_word_length': 2.613095238095238, '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': '193722', 'n_tokens_mistral': 400, 'n_tokens_neox': 391, 'n_words': 95}