Merge pull request #14590 from Homebrew/dependabot/bundler/Library/Homebrew/zeitwerk-2.6.7
build(deps): bump zeitwerk from 2.6.6 to 2.6.7 in /Library/Homebrew
This commit is contained in:
commit
13e5a0972c
@ -215,7 +215,7 @@ GEM
|
|||||||
yard-sorbet (0.6.1)
|
yard-sorbet (0.6.1)
|
||||||
sorbet-runtime (>= 0.5)
|
sorbet-runtime (>= 0.5)
|
||||||
yard (>= 0.9)
|
yard (>= 0.9)
|
||||||
zeitwerk (2.6.6)
|
zeitwerk (2.6.7)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
aarch64-linux
|
aarch64-linux
|
||||||
|
@ -29,6 +29,7 @@ module Zeitwerk::ExplicitNamespace
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
def __register(cpath, loader); end
|
def __register(cpath, loader); end
|
||||||
|
def __registered?(cpath); end
|
||||||
def __unregister_loader(loader); end
|
def __unregister_loader(loader); end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -37,6 +38,7 @@ module Zeitwerk::ExplicitNamespace
|
|||||||
def disable_tracer_if_unneeded; end
|
def disable_tracer_if_unneeded; end
|
||||||
def mutex; end
|
def mutex; end
|
||||||
def register(cpath, loader); end
|
def register(cpath, loader); end
|
||||||
|
def registered?(cpath); end
|
||||||
def tracepoint_class_callback(event); end
|
def tracepoint_class_callback(event); end
|
||||||
def tracer; end
|
def tracer; end
|
||||||
def unregister_loader(loader); end
|
def unregister_loader(loader); end
|
||||||
@ -82,19 +84,18 @@ class Zeitwerk::Loader
|
|||||||
include ::Zeitwerk::Loader::Helpers
|
include ::Zeitwerk::Loader::Helpers
|
||||||
include ::Zeitwerk::Loader::Config
|
include ::Zeitwerk::Loader::Config
|
||||||
include ::Zeitwerk::Loader::EagerLoad
|
include ::Zeitwerk::Loader::EagerLoad
|
||||||
|
extend ::Zeitwerk::Internal
|
||||||
|
|
||||||
def initialize; end
|
def initialize; end
|
||||||
|
|
||||||
def autoloaded_dirs; end
|
def __autoloaded_dirs; end
|
||||||
def autoloads; end
|
def __autoloads; end
|
||||||
def mutex; end
|
def __namespace_dirs; end
|
||||||
def mutex2; end
|
def __shadowed_file?(file); end
|
||||||
def namespace_dirs; end
|
def __shadowed_files; end
|
||||||
|
def __to_unload; end
|
||||||
def reload; end
|
def reload; end
|
||||||
def setup; end
|
def setup; end
|
||||||
def shadowed_file?(file); end
|
|
||||||
def shadowed_files; end
|
|
||||||
def to_unload; end
|
|
||||||
def unload; end
|
def unload; end
|
||||||
def unloadable_cpath?(cpath); end
|
def unloadable_cpath?(cpath); end
|
||||||
def unloadable_cpaths; end
|
def unloadable_cpaths; end
|
||||||
@ -105,12 +106,20 @@ class Zeitwerk::Loader
|
|||||||
def autoload_file(parent, cname, file); end
|
def autoload_file(parent, cname, file); end
|
||||||
def autoload_path_set_by_me_for?(parent, cname); end
|
def autoload_path_set_by_me_for?(parent, cname); end
|
||||||
def autoload_subdir(parent, cname, subdir); end
|
def autoload_subdir(parent, cname, subdir); end
|
||||||
|
def autoloaded_dirs; end
|
||||||
|
def autoloads; end
|
||||||
|
def mutex; end
|
||||||
|
def mutex2; end
|
||||||
|
def namespace_dirs; end
|
||||||
def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:); end
|
def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:); end
|
||||||
def raise_if_conflicting_directory(dir); end
|
def raise_if_conflicting_directory(dir); end
|
||||||
def register_explicit_namespace(cpath); end
|
def register_explicit_namespace(cpath); end
|
||||||
def run_on_unload_callbacks(cpath, value, abspath); end
|
def run_on_unload_callbacks(cpath, value, abspath); end
|
||||||
def set_autoload(parent, cname, abspath); end
|
def set_autoload(parent, cname, abspath); end
|
||||||
def set_autoloads_in_dir(dir, parent); end
|
def set_autoloads_in_dir(dir, parent); end
|
||||||
|
def shadowed_file?(file); end
|
||||||
|
def shadowed_files; end
|
||||||
|
def to_unload; end
|
||||||
def unload_autoload(parent, cname); end
|
def unload_autoload(parent, cname); end
|
||||||
def unload_cref(parent, cname); end
|
def unload_cref(parent, cname); end
|
||||||
|
|
||||||
@ -145,7 +154,7 @@ module Zeitwerk::Loader::Config
|
|||||||
def __ignores?(abspath); end
|
def __ignores?(abspath); end
|
||||||
def __roots; end
|
def __roots; end
|
||||||
def collapse(*glob_patterns); end
|
def collapse(*glob_patterns); end
|
||||||
def dirs(namespaces: T.unsafe(nil)); end
|
def dirs(namespaces: T.unsafe(nil), ignored: T.unsafe(nil)); end
|
||||||
def do_not_eager_load(*paths); end
|
def do_not_eager_load(*paths); end
|
||||||
def enable_reloading; end
|
def enable_reloading; end
|
||||||
def ignore(*glob_patterns); end
|
def ignore(*glob_patterns); end
|
||||||
@ -203,6 +212,7 @@ module Zeitwerk::Loader::Helpers
|
|||||||
def cdef?(parent, cname); end
|
def cdef?(parent, cname); end
|
||||||
def cget(parent, cname); end
|
def cget(parent, cname); end
|
||||||
def cpath(parent, cname); end
|
def cpath(parent, cname); end
|
||||||
|
def crem(parent, cname); end
|
||||||
def dir?(path); end
|
def dir?(path); end
|
||||||
def has_at_least_one_ruby_file?(dir); end
|
def has_at_least_one_ruby_file?(dir); end
|
||||||
def hidden?(basename); end
|
def hidden?(basename); end
|
@ -27,7 +27,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/i18n-1.12.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/i18n-1.12.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/minitest-5.17.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/minitest-5.17.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tzinfo-2.0.6/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tzinfo-2.0.6/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/zeitwerk-2.6.6/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/zeitwerk-2.6.7/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/activesupport-6.1.7.2/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/activesupport-6.1.7.2/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-5.0.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-5.0.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.1/lib")
|
||||||
|
@ -47,6 +47,13 @@ module Zeitwerk
|
|||||||
disable_tracer_if_unneeded
|
disable_tracer_if_unneeded
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This is an internal method only used by the test suite.
|
||||||
|
#
|
||||||
|
# @sig (String) -> bool
|
||||||
|
internal def registered?(cpath)
|
||||||
|
cpaths.key?(cpath)
|
||||||
|
end
|
||||||
|
|
||||||
# @sig () -> void
|
# @sig () -> void
|
||||||
private def disable_tracer_if_unneeded
|
private def disable_tracer_if_unneeded
|
||||||
mutex.synchronize do
|
mutex.synchronize do
|
@ -9,6 +9,8 @@ module Zeitwerk
|
|||||||
require_relative "loader/config"
|
require_relative "loader/config"
|
||||||
require_relative "loader/eager_load"
|
require_relative "loader/eager_load"
|
||||||
|
|
||||||
|
extend Internal
|
||||||
|
|
||||||
include RealModName
|
include RealModName
|
||||||
include Callbacks
|
include Callbacks
|
||||||
include Helpers
|
include Helpers
|
||||||
@ -26,9 +28,9 @@ module Zeitwerk
|
|||||||
# "/Users/fxn/blog/app/models/hotel/pricing.rb" => [Hotel, :Pricing]
|
# "/Users/fxn/blog/app/models/hotel/pricing.rb" => [Hotel, :Pricing]
|
||||||
# ...
|
# ...
|
||||||
#
|
#
|
||||||
# @private
|
|
||||||
# @sig Hash[String, [Module, Symbol]]
|
# @sig Hash[String, [Module, Symbol]]
|
||||||
attr_reader :autoloads
|
attr_reader :autoloads
|
||||||
|
internal :autoloads
|
||||||
|
|
||||||
# We keep track of autoloaded directories to remove them from the registry
|
# We keep track of autoloaded directories to remove them from the registry
|
||||||
# at the end of eager loading.
|
# at the end of eager loading.
|
||||||
@ -36,9 +38,9 @@ module Zeitwerk
|
|||||||
# Files are removed as they are autoloaded, but directories need to wait due
|
# Files are removed as they are autoloaded, but directories need to wait due
|
||||||
# to concurrency (see why in Zeitwerk::Loader::Callbacks#on_dir_autoloaded).
|
# to concurrency (see why in Zeitwerk::Loader::Callbacks#on_dir_autoloaded).
|
||||||
#
|
#
|
||||||
# @private
|
|
||||||
# @sig Array[String]
|
# @sig Array[String]
|
||||||
attr_reader :autoloaded_dirs
|
attr_reader :autoloaded_dirs
|
||||||
|
internal :autoloaded_dirs
|
||||||
|
|
||||||
# Stores metadata needed for unloading. Its entries look like this:
|
# Stores metadata needed for unloading. Its entries look like this:
|
||||||
#
|
#
|
||||||
@ -52,9 +54,9 @@ module Zeitwerk
|
|||||||
# If reloading is enabled, this hash is filled as constants are autoloaded
|
# If reloading is enabled, this hash is filled as constants are autoloaded
|
||||||
# or eager loaded. Otherwise, the collection remains empty.
|
# or eager loaded. Otherwise, the collection remains empty.
|
||||||
#
|
#
|
||||||
# @private
|
|
||||||
# @sig Hash[String, [String, [Module, Symbol]]]
|
# @sig Hash[String, [String, [Module, Symbol]]]
|
||||||
attr_reader :to_unload
|
attr_reader :to_unload
|
||||||
|
internal :to_unload
|
||||||
|
|
||||||
# Maps namespace constant paths to their respective directories.
|
# Maps namespace constant paths to their respective directories.
|
||||||
#
|
#
|
||||||
@ -70,9 +72,9 @@ module Zeitwerk
|
|||||||
# and that its children are spread over those directories. We'll visit them
|
# and that its children are spread over those directories. We'll visit them
|
||||||
# to set up the corresponding autoloads.
|
# to set up the corresponding autoloads.
|
||||||
#
|
#
|
||||||
# @private
|
|
||||||
# @sig Hash[String, Array[String]]
|
# @sig Hash[String, Array[String]]
|
||||||
attr_reader :namespace_dirs
|
attr_reader :namespace_dirs
|
||||||
|
internal :namespace_dirs
|
||||||
|
|
||||||
# A shadowed file is a file managed by this loader that is ignored when
|
# A shadowed file is a file managed by this loader that is ignored when
|
||||||
# setting autoloads because its matching constant is already taken.
|
# setting autoloads because its matching constant is already taken.
|
||||||
@ -81,17 +83,17 @@ module Zeitwerk
|
|||||||
# has only scanned the top-level, `shadowed_files` does not have shadowed
|
# has only scanned the top-level, `shadowed_files` does not have shadowed
|
||||||
# files that may exist deep in the project tree yet.
|
# files that may exist deep in the project tree yet.
|
||||||
#
|
#
|
||||||
# @private
|
|
||||||
# @sig Set[String]
|
# @sig Set[String]
|
||||||
attr_reader :shadowed_files
|
attr_reader :shadowed_files
|
||||||
|
internal :shadowed_files
|
||||||
|
|
||||||
# @private
|
|
||||||
# @sig Mutex
|
# @sig Mutex
|
||||||
attr_reader :mutex
|
attr_reader :mutex
|
||||||
|
private :mutex
|
||||||
|
|
||||||
# @private
|
|
||||||
# @sig Mutex
|
# @sig Mutex
|
||||||
attr_reader :mutex2
|
attr_reader :mutex2
|
||||||
|
private :mutex2
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
@ -134,7 +136,7 @@ module Zeitwerk
|
|||||||
# unload them.
|
# unload them.
|
||||||
#
|
#
|
||||||
# This method is public but undocumented. Main interface is `reload`, which
|
# This method is public but undocumented. Main interface is `reload`, which
|
||||||
# means `unload` + `setup`. This one is avaiable to be used together with
|
# means `unload` + `setup`. This one is available to be used together with
|
||||||
# `unregister`, which is undocumented too.
|
# `unregister`, which is undocumented too.
|
||||||
#
|
#
|
||||||
# @sig () -> void
|
# @sig () -> void
|
||||||
@ -254,9 +256,8 @@ module Zeitwerk
|
|||||||
# The return value of this predicate is only meaningful if the loader has
|
# The return value of this predicate is only meaningful if the loader has
|
||||||
# scanned the file. This is the case in the spots where we use it.
|
# scanned the file. This is the case in the spots where we use it.
|
||||||
#
|
#
|
||||||
# @private
|
|
||||||
# @sig (String) -> Boolean
|
# @sig (String) -> Boolean
|
||||||
def shadowed_file?(file)
|
internal def shadowed_file?(file)
|
||||||
shadowed_files.member?(file)
|
shadowed_files.member?(file)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -323,10 +324,8 @@ module Zeitwerk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private # -------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# @sig (String, Module) -> void
|
# @sig (String, Module) -> void
|
||||||
def set_autoloads_in_dir(dir, parent)
|
private def set_autoloads_in_dir(dir, parent)
|
||||||
ls(dir) do |basename, abspath|
|
ls(dir) do |basename, abspath|
|
||||||
begin
|
begin
|
||||||
if ruby?(basename)
|
if ruby?(basename)
|
||||||
@ -361,13 +360,22 @@ module Zeitwerk
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @sig (Module, Symbol, String) -> void
|
# @sig (Module, Symbol, String) -> void
|
||||||
def autoload_subdir(parent, cname, subdir)
|
private def autoload_subdir(parent, cname, subdir)
|
||||||
if autoload_path = autoload_path_set_by_me_for?(parent, cname)
|
if autoload_path = autoload_path_set_by_me_for?(parent, cname)
|
||||||
cpath = cpath(parent, cname)
|
cpath = cpath(parent, cname)
|
||||||
register_explicit_namespace(cpath) if ruby?(autoload_path)
|
if ruby?(autoload_path)
|
||||||
# We do not need to issue another autoload, the existing one is enough
|
# Scanning visited a Ruby file first, and now a directory for the same
|
||||||
# no matter if it is for a file or a directory. Just remember the
|
# constant has been found. This means we are dealing with an explicit
|
||||||
# subdirectory has to be visited if the namespace is used.
|
# namespace whose definition was seen first.
|
||||||
|
#
|
||||||
|
# Registering is idempotent, and we have to keep the autoload pointing
|
||||||
|
# to the file. This may run again if more directories are found later
|
||||||
|
# on, no big deal.
|
||||||
|
register_explicit_namespace(cpath)
|
||||||
|
end
|
||||||
|
# If the existing autoload points to a file, it has to be preserved, if
|
||||||
|
# not, it is fine as it is. In either case, we do not need to override.
|
||||||
|
# Just remember the subdirectory conforms this namespace.
|
||||||
namespace_dirs[cpath] << subdir
|
namespace_dirs[cpath] << subdir
|
||||||
elsif !cdef?(parent, cname)
|
elsif !cdef?(parent, cname)
|
||||||
# First time we find this namespace, set an autoload for it.
|
# First time we find this namespace, set an autoload for it.
|
||||||
@ -382,7 +390,7 @@ module Zeitwerk
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @sig (Module, Symbol, String) -> void
|
# @sig (Module, Symbol, String) -> void
|
||||||
def autoload_file(parent, cname, file)
|
private def autoload_file(parent, cname, file)
|
||||||
if autoload_path = strict_autoload_path(parent, cname) || Registry.inception?(cpath(parent, cname))
|
if autoload_path = strict_autoload_path(parent, cname) || Registry.inception?(cpath(parent, cname))
|
||||||
# First autoload for a Ruby file wins, just ignore subsequent ones.
|
# First autoload for a Ruby file wins, just ignore subsequent ones.
|
||||||
if ruby?(autoload_path)
|
if ruby?(autoload_path)
|
||||||
@ -408,7 +416,7 @@ module Zeitwerk
|
|||||||
# the file where we've found the namespace is explicitly defined.
|
# the file where we've found the namespace is explicitly defined.
|
||||||
#
|
#
|
||||||
# @sig (dir: String, file: String, parent: Module, cname: Symbol) -> void
|
# @sig (dir: String, file: String, parent: Module, cname: Symbol) -> void
|
||||||
def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:)
|
private def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:)
|
||||||
autoloads.delete(dir)
|
autoloads.delete(dir)
|
||||||
Registry.unregister_autoload(dir)
|
Registry.unregister_autoload(dir)
|
||||||
|
|
||||||
@ -419,7 +427,7 @@ module Zeitwerk
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @sig (Module, Symbol, String) -> void
|
# @sig (Module, Symbol, String) -> void
|
||||||
def set_autoload(parent, cname, abspath)
|
private def set_autoload(parent, cname, abspath)
|
||||||
parent.autoload(cname, abspath)
|
parent.autoload(cname, abspath)
|
||||||
|
|
||||||
if logger
|
if logger
|
||||||
@ -440,7 +448,7 @@ module Zeitwerk
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @sig (Module, Symbol) -> String?
|
# @sig (Module, Symbol) -> String?
|
||||||
def autoload_path_set_by_me_for?(parent, cname)
|
private def autoload_path_set_by_me_for?(parent, cname)
|
||||||
if autoload_path = strict_autoload_path(parent, cname)
|
if autoload_path = strict_autoload_path(parent, cname)
|
||||||
autoload_path if autoloads.key?(autoload_path)
|
autoload_path if autoloads.key?(autoload_path)
|
||||||
else
|
else
|
||||||
@ -449,12 +457,12 @@ module Zeitwerk
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @sig (String) -> void
|
# @sig (String) -> void
|
||||||
def register_explicit_namespace(cpath)
|
private def register_explicit_namespace(cpath)
|
||||||
ExplicitNamespace.__register(cpath, self)
|
ExplicitNamespace.__register(cpath, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @sig (String) -> void
|
# @sig (String) -> void
|
||||||
def raise_if_conflicting_directory(dir)
|
private def raise_if_conflicting_directory(dir)
|
||||||
MUTEX.synchronize do
|
MUTEX.synchronize do
|
||||||
dir_slash = dir + "/"
|
dir_slash = dir + "/"
|
||||||
|
|
||||||
@ -479,23 +487,23 @@ module Zeitwerk
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @sig (String, Object, String) -> void
|
# @sig (String, Object, String) -> void
|
||||||
def run_on_unload_callbacks(cpath, value, abspath)
|
private def run_on_unload_callbacks(cpath, value, abspath)
|
||||||
# Order matters. If present, run the most specific one.
|
# Order matters. If present, run the most specific one.
|
||||||
on_unload_callbacks[cpath]&.each { |c| c.call(value, abspath) }
|
on_unload_callbacks[cpath]&.each { |c| c.call(value, abspath) }
|
||||||
on_unload_callbacks[:ANY]&.each { |c| c.call(cpath, value, abspath) }
|
on_unload_callbacks[:ANY]&.each { |c| c.call(cpath, value, abspath) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# @sig (Module, Symbol) -> void
|
# @sig (Module, Symbol) -> void
|
||||||
def unload_autoload(parent, cname)
|
private def unload_autoload(parent, cname)
|
||||||
parent.__send__(:remove_const, cname)
|
crem(parent, cname)
|
||||||
log("autoload for #{cpath(parent, cname)} removed") if logger
|
log("autoload for #{cpath(parent, cname)} removed") if logger
|
||||||
end
|
end
|
||||||
|
|
||||||
# @sig (Module, Symbol) -> void
|
# @sig (Module, Symbol) -> void
|
||||||
def unload_cref(parent, cname)
|
private def unload_cref(parent, cname)
|
||||||
# Let's optimistically remove_const. The way we use it, this is going to
|
# Let's optimistically remove_const. The way we use it, this is going to
|
||||||
# succeed always if all is good.
|
# succeed always if all is good.
|
||||||
parent.__send__(:remove_const, cname)
|
crem(parent, cname)
|
||||||
rescue ::NameError
|
rescue ::NameError
|
||||||
# There are a few edge scenarios in which this may happen. If the constant
|
# There are a few edge scenarios in which this may happen. If the constant
|
||||||
# is gone, that is OK, anyway.
|
# is gone, that is OK, anyway.
|
@ -11,18 +11,18 @@ module Zeitwerk::Loader::Callbacks
|
|||||||
cref = autoloads.delete(file)
|
cref = autoloads.delete(file)
|
||||||
cpath = cpath(*cref)
|
cpath = cpath(*cref)
|
||||||
|
|
||||||
# If reloading is enabled, we need to put this constant for unloading
|
|
||||||
# regardless of what cdef? says. In Ruby < 3.1 the internal state is not
|
|
||||||
# fully cleared. Module#constants still includes it, and you need to
|
|
||||||
# remove_const. See https://github.com/ruby/ruby/pull/4715.
|
|
||||||
to_unload[cpath] = [file, cref] if reloading_enabled?
|
|
||||||
Zeitwerk::Registry.unregister_autoload(file)
|
Zeitwerk::Registry.unregister_autoload(file)
|
||||||
|
|
||||||
if cdef?(*cref)
|
if cdef?(*cref)
|
||||||
log("constant #{cpath} loaded from file #{file}") if logger
|
log("constant #{cpath} loaded from file #{file}") if logger
|
||||||
|
to_unload[cpath] = [file, cref] if reloading_enabled?
|
||||||
run_on_load_callbacks(cpath, cget(*cref), file) unless on_load_callbacks.empty?
|
run_on_load_callbacks(cpath, cget(*cref), file) unless on_load_callbacks.empty?
|
||||||
else
|
else
|
||||||
raise Zeitwerk::NameError.new("expected file #{file} to define constant #{cpath}, but didn't", cref.last)
|
msg = "expected file #{file} to define constant #{cpath}, but didn't"
|
||||||
|
log(msg) if logger
|
||||||
|
crem(*cref)
|
||||||
|
to_unload[cpath] = [file, cref] if reloading_enabled?
|
||||||
|
raise Zeitwerk::NameError.new(msg, cref.last)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -149,14 +149,24 @@ module Zeitwerk::Loader::Config
|
|||||||
# instead. Keys are the absolute paths of the root directories as strings,
|
# instead. Keys are the absolute paths of the root directories as strings,
|
||||||
# values are their corresponding namespaces, class or module objects.
|
# values are their corresponding namespaces, class or module objects.
|
||||||
#
|
#
|
||||||
|
# If `ignored` is falsey (default), ignored root directories are filtered out.
|
||||||
|
#
|
||||||
# These are read-only collections, please add to them with `push_dir`.
|
# These are read-only collections, please add to them with `push_dir`.
|
||||||
#
|
#
|
||||||
# @sig () -> Array[String] | Hash[String, Module]
|
# @sig () -> Array[String] | Hash[String, Module]
|
||||||
def dirs(namespaces: false)
|
def dirs(namespaces: false, ignored: false)
|
||||||
if namespaces
|
if namespaces
|
||||||
roots.clone
|
if ignored || ignored_paths.empty?
|
||||||
|
roots.clone
|
||||||
|
else
|
||||||
|
roots.reject { |root_dir, _namespace| ignored_path?(root_dir) }
|
||||||
|
end
|
||||||
else
|
else
|
||||||
roots.keys
|
if ignored || ignored_paths.empty?
|
||||||
|
roots.keys
|
||||||
|
else
|
||||||
|
roots.keys.reject { |root_dir| ignored_path?(root_dir) }
|
||||||
|
end
|
||||||
end.freeze
|
end.freeze
|
||||||
end
|
end
|
||||||
|
|
@ -183,7 +183,7 @@ module Zeitwerk::Loader::EagerLoad
|
|||||||
end
|
end
|
||||||
|
|
||||||
# In order to invoke this method, the caller has to ensure `child` is a
|
# In order to invoke this method, the caller has to ensure `child` is a
|
||||||
# strict namespace descendendant of `root_namespace`.
|
# strict namespace descendant of `root_namespace`.
|
||||||
#
|
#
|
||||||
# @sig (Module, String, Module, Boolean) -> void
|
# @sig (Module, String, Module, Boolean) -> void
|
||||||
private def eager_load_child_namespace(child, child_name, root_dir, root_namespace)
|
private def eager_load_child_namespace(child, child_name, root_dir, root_namespace)
|
@ -134,4 +134,10 @@ module Zeitwerk::Loader::Helpers
|
|||||||
private def cget(parent, cname)
|
private def cget(parent, cname)
|
||||||
parent.const_get(cname, false)
|
parent.const_get(cname, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @raise [NameError]
|
||||||
|
# @sig (Module, Symbol) -> Object
|
||||||
|
private def crem(parent, cname)
|
||||||
|
parent.__send__(:remove_const, cname)
|
||||||
|
end
|
||||||
end
|
end
|
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Zeitwerk
|
module Zeitwerk
|
||||||
VERSION = "2.6.6"
|
VERSION = "2.6.7"
|
||||||
end
|
end
|
Loading…
x
Reference in New Issue
Block a user