module T::Private::Methods

def self.install_hooks(mod)

def self.install_hooks(mod)
  return if @installed_hooks.include?(mod)
  @installed_hooks << mod
  if mod.singleton_class?
    install_singleton_method_added_hook(mod)
  else
    original_method = T::Private::ClassUtils.replace_method(mod.singleton_class, :method_added) do |name|
      T::Private::Methods._on_method_added(self, name)
      original_method.bind(self).call(name)
    end
  end
  install_singleton_method_added_hook(mod.singleton_class)
end