<commit_before>require 'set'

module UV
  module Listener
    module ClassMethods
      def const_unset(name)
        remove_const(name)
      end
    end

    def self.included(base)
      base.extend(ClassMethods)
    end

    private
    def callbacks
      @callbacks ||= Set.new
    end

    def callback(name)
      callbacks << name
      const_name = "#{name.upcase}_#{object_id}"
      unless self.class.const_defined?(const_name)
        self.class.const_set(const_name, method(name))
      end
      self.class.const_get(const_name)
    end

    def clear_callbacks
      callbacks.each do |name|
        self.class.const_unset("#{name.upcase}_#{object_id}")
      end
      callbacks.clear
    end
  end
end<commit_msg>don't define helper method when Listener included<commit_after>require 'set'

module UV
  module Listener
    private
    def callbacks
      @callbacks ||= Set.new
    end

    def callback(name)
      callbacks << name
      const_name = "#{name.upcase}_#{object_id}"
      unless self.class.const_defined?(const_name)
        self.class.const_set(const_name, method(name))
      end
      self.class.const_get(const_name)
    end

    def clear_callbacks
      callbacks.each do |name|
        self.class.send(:remove_const, "#{name.upcase}_#{object_id}")
      end
      callbacks.clear
    end
  end
end
{'fraction_non_alphanumeric': 0.0948469006721434, 'fraction_numerical': 0.0, 'mean_word_length': 2.5543766578249336, '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': '4581487', 'n_tokens_mistral': 433, 'n_tokens_neox': 432, 'n_words': 89}