brew vendor-gems: commit updates.

This commit is contained in:
BrewTestBot 2021-10-21 18:11:23 +00:00
parent 44739a3713
commit 14d5625620
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
15 changed files with 24 additions and 92 deletions

View File

@ -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/minitest-5.14.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/public_suffix-4.0.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/addressable-2.8.0/lib"

View File

@ -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

View File

@ -3,7 +3,6 @@
module Zeitwerk
require_relative "zeitwerk/real_mod_name"
require_relative "zeitwerk/loader"
require_relative "zeitwerk/autoloads"
require_relative "zeitwerk/registry"
require_relative "zeitwerk/explicit_namespace"
require_relative "zeitwerk/inflector"

View File

@ -14,22 +14,16 @@ module Zeitwerk
include Helpers
include Config
# Keeps track of autoloads defined by the loader which have not been
# executed so far.
# Maps absolute paths for which an autoload has been set ---and not
# executed--- to their corresponding parent class or module and constant
# name.
#
# This metadata helps us implement a few things:
#
# 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.
# "/Users/fxn/blog/app/models/user.rb" => [Object, :User],
# "/Users/fxn/blog/app/models/hotel/pricing.rb" => [Hotel, :Pricing]
# ...
#
# @private
# @sig Zeitwerk::Autoloads
# @sig Hash[String, [Module, Symbol]]
attr_reader :autoloads
# We keep track of autoloaded directories to remove them from the registry
@ -87,7 +81,7 @@ module Zeitwerk
def initialize
super
@autoloads = Autoloads.new
@autoloads = {}
@autoloaded_dirs = []
@to_unload = {}
@lazy_subdirs = Hash.new { |h, cpath| h[cpath] = [] }
@ -138,7 +132,7 @@ module Zeitwerk
# is enough.
unloaded_files = Set.new
autoloads.each do |(parent, cname), abspath|
autoloads.each do |abspath, (parent, cname)|
if parent.autoload?(cname)
unload_autoload(parent, cname)
else
@ -234,7 +228,7 @@ module Zeitwerk
next if honour_exclusions && excluded_from_eager_load?(abspath)
if ruby?(abspath)
if cref = autoloads.cref_for(abspath)
if cref = autoloads[abspath]
cget(*cref)
end
elsif dir?(abspath) && !root_dirs.key?(abspath)
@ -376,7 +370,7 @@ module Zeitwerk
# @sig (Module, Symbol, String) -> void
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)
register_explicit_namespace(cpath) if ruby?(autoload_path)
# We do not need to issue another autoload, the existing one is enough
@ -432,7 +426,7 @@ module Zeitwerk
# @sig (Module, Symbol, String) -> void
def set_autoload(parent, cname, abspath)
autoloads.define(parent, cname, abspath)
parent.autoload(cname, abspath)
if logger
if ruby?(abspath)
@ -442,6 +436,7 @@ module Zeitwerk
end
end
autoloads[abspath] = [parent, cname]
Registry.register_autoload(self, abspath)
# See why in the documentation of Zeitwerk::Registry.inceptions.
@ -450,6 +445,15 @@ module Zeitwerk
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
def register_explicit_namespace(cpath)
ExplicitNamespace.register(cpath, self)

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true
module Zeitwerk
VERSION = "2.5.0"
VERSION = "2.5.1"
end