module ActiveSupport::Dependencies::Loadable

def self.exclude_from(base)

:nodoc:
Object includes this module.
def self.exclude_from(base)
  base.class_eval do
    define_method(:load, Kernel.instance_method(:load))
    private :load
    define_method(:require, Kernel.instance_method(:require))
    private :require
  end
end

def self.include_into(base)

def self.include_into(base)
  base.include(self)
  if base.instance_method(:load).owner == base
    base.remove_method(:load)
  end
  if base.instance_method(:require).owner == base
    base.remove_method(:require)
  end
end

def load(file, wrap = false)

def load(file, wrap = false)
  result = false
  load_dependency(file) { result = super }
  result
end

def load_dependency(file)

def load_dependency(file)
  if Dependencies.load? && Dependencies.constant_watch_stack.watching?
    descs = Dependencies.constant_watch_stack.watching.flatten.uniq
    Dependencies.new_constants_in(*descs) { yield }
  else
    yield
  end
rescue Exception => exception  # errors from loading file
  exception.blame_file! file if exception.respond_to? :blame_file!
  raise
end

def require(file)

def require(file)
  result = false
  load_dependency(file) { result = super }
  result
end

def require_dependency(file_name, message = "No such file to load -- %s.rb")

otherwise.
different namespaces whose evaluation would depend on load order
resolution deterministic for constants with the same relative name in
defined at that point. A typical use case is to make constant name
Use this method in code that absolutely needs a certain constant to be

respond to to_path.
constants as autoloaded. file_name can be either a string or
Interprets a file using mechanism and marks its defined
def require_dependency(file_name, message = "No such file to load -- %s.rb")
  file_name = file_name.to_path if file_name.respond_to?(:to_path)
  unless file_name.is_a?(String)
    raise ArgumentError, "the file name must either be a String or implement #to_path -- you passed #{file_name.inspect}"
  end
  Dependencies.depend_on(file_name, message)
end

def require_or_load(file_name)

def require_or_load(file_name)
  Dependencies.require_or_load(file_name)
end

def unloadable(const_desc)

+false+ otherwise.
Returns +true+ if the constant was not previously marked for unloading,

or a qualified constant name as a string or symbol.
The provided constant descriptor may be a (non-anonymous) module or class,

for the first clear.
each constant will be removed for every subsequent clear, as opposed to
or init scripts may list each unloadable constant that may need unloading;
Note that marking a constant for unloading need only be done once. Setup

each time dependencies are cleared.
Mark the given constant as unloadable. Unloadable constants are removed
def unloadable(const_desc)
  Dependencies.mark_for_unload const_desc
end