module Bootsnap::LoadPathCache
def setup(cache_path:, development_mode:, ignore_directories:, readonly: false)
def setup(cache_path:, development_mode:, ignore_directories:, readonly: false) unless supported? warn("[bootsnap/setup] Load path caching is not supported on this implementation of Ruby") if $VERBOSE return end store = Store.new(cache_path, readonly: readonly) @loaded_features_index = LoadedFeaturesIndex.new PathScanner.ignored_directories = ignore_directories if ignore_directories @load_path_cache = Cache.new(store, $LOAD_PATH, development_mode: development_mode) @enabled = true require_relative("load_path_cache/core_ext/kernel_require") require_relative("load_path_cache/core_ext/loaded_features") end
def supported?
def supported? if RUBY_PLATFORM.match?(/darwin|linux|bsd|mswin|mingw|cygwin/) case RUBY_ENGINE when "truffleruby" # https://github.com/oracle/truffleruby/issues/3131 RUBY_ENGINE_VERSION >= "23.1.0" when "ruby" true else false end end end
def unload!
def unload! @enabled = false @loaded_features_index = nil @realpath_cache = nil @load_path_cache = nil ChangeObserver.unregister($LOAD_PATH) if supported? end