Merge pull request #12291 from Homebrew/dependabot/bundler/Library/Homebrew/zeitwerk-2.5.1
build(deps): bump zeitwerk from 2.5.0 to 2.5.1 in /Library/Homebrew
This commit is contained in:
commit
1707f4b981
@ -189,7 +189,7 @@ GEM
|
|||||||
warning (1.2.1)
|
warning (1.2.1)
|
||||||
webrick (1.7.0)
|
webrick (1.7.0)
|
||||||
webrobots (0.1.2)
|
webrobots (0.1.2)
|
||||||
zeitwerk (2.5.0)
|
zeitwerk (2.5.1)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
@ -22,20 +22,6 @@ module Zeitwerk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Zeitwerk::Autoloads
|
|
||||||
def initialize; end
|
|
||||||
|
|
||||||
def a2c; end
|
|
||||||
def abspath_for(parent, cname); end
|
|
||||||
def c2a; end
|
|
||||||
def clear; end
|
|
||||||
def cref_for(abspath); end
|
|
||||||
def define(parent, cname, abspath); end
|
|
||||||
def delete(abspath); end
|
|
||||||
def each(&block); end
|
|
||||||
def empty?; end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Zeitwerk::Error < ::StandardError; end
|
class Zeitwerk::Error < ::StandardError; end
|
||||||
|
|
||||||
module Zeitwerk::ExplicitNamespace
|
module Zeitwerk::ExplicitNamespace
|
||||||
@ -95,6 +81,7 @@ class Zeitwerk::Loader
|
|||||||
private
|
private
|
||||||
|
|
||||||
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_subdir(parent, cname, subdir); end
|
def autoload_subdir(parent, cname, subdir); 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
|
@ -5537,6 +5537,8 @@ end
|
|||||||
|
|
||||||
module MonitorMixin
|
module MonitorMixin
|
||||||
def initialize(*args); end
|
def initialize(*args); end
|
||||||
|
EXCEPTION_IMMEDIATE = ::T.let(nil, ::T.untyped)
|
||||||
|
EXCEPTION_NEVER = ::T.let(nil, ::T.untyped)
|
||||||
end
|
end
|
||||||
|
|
||||||
class MonitorMixin::ConditionVariable
|
class MonitorMixin::ConditionVariable
|
||||||
|
@ -7,7 +7,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.9
|
|||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.10/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.10/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.14.4/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.14.4/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.4/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.4/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.5.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.5.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.1.4.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.1.4.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/public_suffix-4.0.6/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/public_suffix-4.0.6/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/addressable-2.8.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/addressable-2.8.0/lib"
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Zeitwerk
|
|
||||||
# @private
|
|
||||||
class Autoloads
|
|
||||||
# Maps crefs for which an autoload has been defined to the corresponding
|
|
||||||
# absolute path.
|
|
||||||
#
|
|
||||||
# [Object, :User] => "/Users/fxn/blog/app/models/user.rb"
|
|
||||||
# [Object, :Hotel] => "/Users/fxn/blog/app/models/hotel"
|
|
||||||
# ...
|
|
||||||
#
|
|
||||||
# This colection is transient, callbacks delete its entries as autoloads get
|
|
||||||
# executed.
|
|
||||||
#
|
|
||||||
# @sig Hash[[Module, Symbol], String]
|
|
||||||
attr_reader :c2a
|
|
||||||
|
|
||||||
# This is the inverse of c2a, for inverse lookups.
|
|
||||||
#
|
|
||||||
# @sig Hash[String, [Module, Symbol]]
|
|
||||||
attr_reader :a2c
|
|
||||||
|
|
||||||
# @sig () -> void
|
|
||||||
def initialize
|
|
||||||
@c2a = {}
|
|
||||||
@a2c = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
# @sig (Module, Symbol, String) -> void
|
|
||||||
def define(parent, cname, abspath)
|
|
||||||
parent.autoload(cname, abspath)
|
|
||||||
cref = [parent, cname]
|
|
||||||
c2a[cref] = abspath
|
|
||||||
a2c[abspath] = cref
|
|
||||||
end
|
|
||||||
|
|
||||||
# @sig () { () -> [[Module, Symbol], String] } -> void
|
|
||||||
def each(&block)
|
|
||||||
c2a.each(&block)
|
|
||||||
end
|
|
||||||
|
|
||||||
# @sig (Module, Symbol) -> String?
|
|
||||||
def abspath_for(parent, cname)
|
|
||||||
c2a[[parent, cname]]
|
|
||||||
end
|
|
||||||
|
|
||||||
# @sig (String) -> [Module, Symbol]?
|
|
||||||
def cref_for(abspath)
|
|
||||||
a2c[abspath]
|
|
||||||
end
|
|
||||||
|
|
||||||
# @sig (String) -> [Module, Symbol]?
|
|
||||||
def delete(abspath)
|
|
||||||
cref = a2c.delete(abspath)
|
|
||||||
c2a.delete(cref)
|
|
||||||
cref
|
|
||||||
end
|
|
||||||
|
|
||||||
# @sig () -> void
|
|
||||||
def clear
|
|
||||||
c2a.clear
|
|
||||||
a2c.clear
|
|
||||||
end
|
|
||||||
|
|
||||||
# @sig () -> bool
|
|
||||||
def empty?
|
|
||||||
c2a.empty? && a2c.empty?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -3,7 +3,6 @@
|
|||||||
module Zeitwerk
|
module Zeitwerk
|
||||||
require_relative "zeitwerk/real_mod_name"
|
require_relative "zeitwerk/real_mod_name"
|
||||||
require_relative "zeitwerk/loader"
|
require_relative "zeitwerk/loader"
|
||||||
require_relative "zeitwerk/autoloads"
|
|
||||||
require_relative "zeitwerk/registry"
|
require_relative "zeitwerk/registry"
|
||||||
require_relative "zeitwerk/explicit_namespace"
|
require_relative "zeitwerk/explicit_namespace"
|
||||||
require_relative "zeitwerk/inflector"
|
require_relative "zeitwerk/inflector"
|
@ -14,22 +14,16 @@ module Zeitwerk
|
|||||||
include Helpers
|
include Helpers
|
||||||
include Config
|
include Config
|
||||||
|
|
||||||
# Keeps track of autoloads defined by the loader which have not been
|
# Maps absolute paths for which an autoload has been set ---and not
|
||||||
# executed so far.
|
# executed--- to their corresponding parent class or module and constant
|
||||||
|
# name.
|
||||||
#
|
#
|
||||||
# This metadata helps us implement a few things:
|
# "/Users/fxn/blog/app/models/user.rb" => [Object, :User],
|
||||||
#
|
# "/Users/fxn/blog/app/models/hotel/pricing.rb" => [Hotel, :Pricing]
|
||||||
# 1. When autoloads are triggered, ensure they define the expected constant
|
# ...
|
||||||
# and invoke user callbacks. If reloading is enabled, remember cref and
|
|
||||||
# abspath for later unloading logic.
|
|
||||||
#
|
|
||||||
# 2. When unloading, remove autoloads that have not been executed.
|
|
||||||
#
|
|
||||||
# 3. Eager load with a recursive const_get, rather than a recursive require,
|
|
||||||
# for consistency with lazy loading.
|
|
||||||
#
|
#
|
||||||
# @private
|
# @private
|
||||||
# @sig Zeitwerk::Autoloads
|
# @sig Hash[String, [Module, Symbol]]
|
||||||
attr_reader :autoloads
|
attr_reader :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
|
||||||
@ -87,7 +81,7 @@ module Zeitwerk
|
|||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
|
|
||||||
@autoloads = Autoloads.new
|
@autoloads = {}
|
||||||
@autoloaded_dirs = []
|
@autoloaded_dirs = []
|
||||||
@to_unload = {}
|
@to_unload = {}
|
||||||
@lazy_subdirs = Hash.new { |h, cpath| h[cpath] = [] }
|
@lazy_subdirs = Hash.new { |h, cpath| h[cpath] = [] }
|
||||||
@ -138,7 +132,7 @@ module Zeitwerk
|
|||||||
# is enough.
|
# is enough.
|
||||||
unloaded_files = Set.new
|
unloaded_files = Set.new
|
||||||
|
|
||||||
autoloads.each do |(parent, cname), abspath|
|
autoloads.each do |abspath, (parent, cname)|
|
||||||
if parent.autoload?(cname)
|
if parent.autoload?(cname)
|
||||||
unload_autoload(parent, cname)
|
unload_autoload(parent, cname)
|
||||||
else
|
else
|
||||||
@ -234,7 +228,7 @@ module Zeitwerk
|
|||||||
next if honour_exclusions && excluded_from_eager_load?(abspath)
|
next if honour_exclusions && excluded_from_eager_load?(abspath)
|
||||||
|
|
||||||
if ruby?(abspath)
|
if ruby?(abspath)
|
||||||
if cref = autoloads.cref_for(abspath)
|
if cref = autoloads[abspath]
|
||||||
cget(*cref)
|
cget(*cref)
|
||||||
end
|
end
|
||||||
elsif dir?(abspath) && !root_dirs.key?(abspath)
|
elsif dir?(abspath) && !root_dirs.key?(abspath)
|
||||||
@ -376,7 +370,7 @@ module Zeitwerk
|
|||||||
|
|
||||||
# @sig (Module, Symbol, String) -> void
|
# @sig (Module, Symbol, String) -> void
|
||||||
def autoload_subdir(parent, cname, subdir)
|
def autoload_subdir(parent, cname, subdir)
|
||||||
if autoload_path = autoloads.abspath_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)
|
register_explicit_namespace(cpath) if ruby?(autoload_path)
|
||||||
# We do not need to issue another autoload, the existing one is enough
|
# We do not need to issue another autoload, the existing one is enough
|
||||||
@ -432,7 +426,7 @@ module Zeitwerk
|
|||||||
|
|
||||||
# @sig (Module, Symbol, String) -> void
|
# @sig (Module, Symbol, String) -> void
|
||||||
def set_autoload(parent, cname, abspath)
|
def set_autoload(parent, cname, abspath)
|
||||||
autoloads.define(parent, cname, abspath)
|
parent.autoload(cname, abspath)
|
||||||
|
|
||||||
if logger
|
if logger
|
||||||
if ruby?(abspath)
|
if ruby?(abspath)
|
||||||
@ -442,6 +436,7 @@ module Zeitwerk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
autoloads[abspath] = [parent, cname]
|
||||||
Registry.register_autoload(self, abspath)
|
Registry.register_autoload(self, abspath)
|
||||||
|
|
||||||
# See why in the documentation of Zeitwerk::Registry.inceptions.
|
# See why in the documentation of Zeitwerk::Registry.inceptions.
|
||||||
@ -450,6 +445,15 @@ module Zeitwerk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @sig (Module, Symbol) -> String?
|
||||||
|
def autoload_path_set_by_me_for?(parent, cname)
|
||||||
|
if autoload_path = strict_autoload_path(parent, cname)
|
||||||
|
autoload_path if autoloads.key?(autoload_path)
|
||||||
|
else
|
||||||
|
Registry.inception?(cpath(parent, cname))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# @sig (String) -> void
|
# @sig (String) -> void
|
||||||
def register_explicit_namespace(cpath)
|
def register_explicit_namespace(cpath)
|
||||||
ExplicitNamespace.register(cpath, self)
|
ExplicitNamespace.register(cpath, self)
|
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Zeitwerk
|
module Zeitwerk
|
||||||
VERSION = "2.5.0"
|
VERSION = "2.5.1"
|
||||||
end
|
end
|
Loading…
x
Reference in New Issue
Block a user