module ActiveSupport::Dependencies::Loadable

def self.excluded(base) #:nodoc:

:nodoc:
def self.excluded(base) #:nodoc:
  base.class_eval do
    if defined? load_without_new_constant_marking
      undef_method :load
      alias_method :load, :load_without_new_constant_marking
      undef_method :load_without_new_constant_marking
    end
  end
end

def self.included(base) #:nodoc:

:nodoc:
:nodoc:
Object includes this module
def self.included(base) #:nodoc:
  base.class_eval do
    unless defined? load_without_new_constant_marking
      alias_method_chain :load, :new_constant_marking
    end
  end
end

def load_with_new_constant_marking(file, *extras) #:nodoc:

:nodoc:
def load_with_new_constant_marking(file, *extras) #:nodoc:
  if Dependencies.load?
    Dependencies.new_constants_in(Object) { load_without_new_constant_marking(file, *extras) }
  else
    load_without_new_constant_marking(file, *extras)
  end
rescue Exception => exception  # errors from loading file
  exception.blame_file! file
  raise
end

def require(file, *extras) #:nodoc:

:nodoc:
def require(file, *extras) #:nodoc:
  if Dependencies.load?
    Dependencies.new_constants_in(Object) { super }
  else
    super
  end
rescue Exception => exception  # errors from required file
  exception.blame_file! file
  raise
end

def require_association(file_name)

def require_association(file_name)
  Dependencies.associate_with(file_name)
end

def require_dependency(file_name)

def require_dependency(file_name)
  Dependencies.depend_on(file_name)
end

def require_or_load(file_name)

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

def unloadable(const_desc)

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

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

the first clear.
each constant will be removed for every subsequent clear, as opposed to for
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

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