module Kernel

Public Instance Methods

require(path) click to toggle source

@param path [String] @return [Boolean]

# File lib/zeitwerk/kernel.rb, line 13
def require(path)
  if loader = Zeitwerk::Registry.loader_for(path)
    if path.end_with?(".rb")
      zeitwerk_original_require(path).tap do |required|
        loader.on_file_autoloaded(path) if required
      end
    else
      loader.on_dir_autoloaded(path)
    end
  else
    zeitwerk_original_require(path).tap do |required|
      if required
        realpath = $LOADED_FEATURES.last
        if loader = Zeitwerk::Registry.loader_for(realpath)
          loader.on_file_autoloaded(realpath)
        end
      end
    end
  end
end
Also aliased as: zeitwerk_original_require
zeitwerk_original_require(path)

We cannot decorate with prepend + super because Kernel has already been included in Object, and changes in ancestors don't get propagated into already existing ancestor chains.

Alias for: require