module ActiveSupport::Dependencies

def remove_unloadable_constants!

may have already been unloaded and not accessible.
as the environment will be in an inconsistent state, e.g. other constants
The callback implementation should be restricted to cleaning up caches, etc.

to its class/module if it implements +before_remove_const+.
marked for unloading. Before each constant is removed a callback is sent
Remove the constants that have been autoloaded, and those that have been
def remove_unloadable_constants!
  log("removing unloadable constants")
  autoloaded_constants.each { |const| remove_constant const }
  autoloaded_constants.clear
  Reference.clear!
  explicitly_unloadable_constants.each { |const| remove_constant const }
end