module Bootsnap::LoadPathCache::CoreExt::ActiveSupport::ClassMethods

def load_missing_constant(from_mod, const_name)

200+ lines of monkeypatches.
behaviour. The gymnastics here are a bit awkward, but it prevents
These methods call search_for_file, and we want to modify its

search_for_file, try again with the default implementation.
If we can't find a constant using the patched implementation of
def load_missing_constant(from_mod, const_name)
  super
rescue NameError => e
  # NoMethodError is a NameError, but we only want to handle actual
  # NameError instances.
  raise unless e.class == NameError
  # We can only confidently handle cases when *this* constant fails
  # to load, not other constants referred to by it.
  raise unless e.name == const_name
  # If the constant was actually loaded, something else went wrong?
  raise if from_mod.const_defined?(const_name)
  CoreExt::ActiveSupport.without_bootsnap_cache { super }
end