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

Public Instance Methods

autoload_paths=(o) click to toggle source
Calls superclass method
# File lib/bootsnap/load_path_cache/core_ext/active_support.rb, line 14
def autoload_paths=(o)
  super
  Bootsnap::LoadPathCache.autoload_paths_cache.reinitialize(o)
end
autoloadable_module?(path_suffix) click to toggle source
# File lib/bootsnap/load_path_cache/core_ext/active_support.rb, line 28
def autoloadable_module?(path_suffix)
  Bootsnap::LoadPathCache.autoload_paths_cache.has_dir?(path_suffix)
end
depend_on(*) click to toggle source

Signature has changed a few times over the years; easiest to not reiterate it with version polymorphism here…

Calls superclass method
# File lib/bootsnap/load_path_cache/core_ext/active_support.rb, line 58
def depend_on(*)
  super
rescue LoadError
  CoreExt::ActiveSupport.without_bootsnap_cache { super }
end
load_missing_constant(from_mod, const_name) click to toggle source

If we can't find a constant using the patched implementation of #search_for_file, try again with the default implementation.

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

Calls superclass method
# File lib/bootsnap/load_path_cache/core_ext/active_support.rb, line 42
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
remove_constant(const) click to toggle source
Calls superclass method
# File lib/bootsnap/load_path_cache/core_ext/active_support.rb, line 32
def remove_constant(const)
  CoreExt::ActiveSupport.without_bootsnap_cache { super }
end
search_for_file(path) click to toggle source
Calls superclass method
# File lib/bootsnap/load_path_cache/core_ext/active_support.rb, line 19
def search_for_file(path)
  return super if Thread.current[:without_bootsnap_cache]
  begin
    Bootsnap::LoadPathCache.autoload_paths_cache.find(path)
  rescue Bootsnap::LoadPathCache::ReturnFalse
    nil # doesn't really apply here
  end
end