Hello community,
here is the log from the commit of package rubygem-zeitwerk for
openSUSE:Factory checked in at 2020-11-02 10:36:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-zeitwerk (Old)
and /work/SRC/openSUSE:Factory/.rubygem-zeitwerk.new.3463 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-zeitwerk"
Mon Nov 2 10:36:07 2020 rev:7 rq:845263 version:2.4.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-zeitwerk/rubygem-zeitwerk.changes
2020-07-16 12:21:42.223161989 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-zeitwerk.new.3463/rubygem-zeitwerk.changes
2020-11-02 10:36:31.267301969 +0100
@@ -1,0 +2,7 @@
+Sun Nov 1 13:09:57 UTC 2020 - Manuel Schnitzer <[email protected]>
+
+- updated to version 2.4.1
+
+ * Use `__send__` instead of `send` internally.
+
+-------------------------------------------------------------------
Old:
----
zeitwerk-2.4.0.gem
New:
----
zeitwerk-2.4.1.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-zeitwerk.spec ++++++
--- /var/tmp/diff_new_pack.WHLwOU/_old 2020-11-02 10:36:33.099303225 +0100
+++ /var/tmp/diff_new_pack.WHLwOU/_new 2020-11-02 10:36:33.103303228 +0100
@@ -24,7 +24,7 @@
#
Name: rubygem-zeitwerk
-Version: 2.4.0
+Version: 2.4.1
Release: 0
%define mod_name zeitwerk
%define mod_full_name %{mod_name}-%{version}
++++++ zeitwerk-2.4.0.gem -> zeitwerk-2.4.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2020-07-15 00:11:04.000000000 +0200
+++ new/README.md 2020-10-29 11:34:25.000000000 +0100
@@ -151,7 +151,7 @@
loader.push_dir("#{__dir__}/adapters", namespace: ActiveJob::QueueAdapters)
```
-your adapter can be stored directly in that directory instead of the canonical
`lib/active_job/queue_adapters`.
+your adapter can be stored directly in that directory instead of the canonical
`#{__dir__}/active_job/queue_adapters`.
Please, note that the given namespace must be non-reloadable, though
autoloaded constants in that namespace can be. That is, if you associate
`app/api` with an existing `Api` module, that module should not be reloadable.
However, if the project defines and autoloads the class `Api::V2::Deliveries`,
that one can be reloaded.
@@ -202,7 +202,7 @@
To make it work that way, configure Zeitwerk to collapse said directory:
```ruby
-loader.collapse("booking/actions")
+loader.collapse("#{__dir__}/booking/actions")
```
This method accepts an arbitrary number of strings or `Pathname` objects, and
also an array of them.
@@ -212,7 +212,7 @@
To illustrate usage of glob patterns, if `actions` in the example above is
part of a standardized structure, you could use a wildcard:
```ruby
-loader.collapse("*/actions")
+loader.collapse("#{__dir__}/*/actions")
```
<a id="markdown-nested-root-directories" name="nested-root-directories"></a>
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/zeitwerk/explicit_namespace.rb
new/lib/zeitwerk/explicit_namespace.rb
--- old/lib/zeitwerk/explicit_namespace.rb 2020-07-15 00:11:04.000000000
+0200
+++ new/lib/zeitwerk/explicit_namespace.rb 2020-10-29 11:34:25.000000000
+0100
@@ -14,24 +14,22 @@
# the file system, to the loader responsible for them.
#
# @private
- # @return [{String => Zeitwerk::Loader}]
+ # @sig Hash[String, Zeitwerk::Loader]
attr_reader :cpaths
# @private
- # @return [Mutex]
+ # @sig Mutex
attr_reader :mutex
# @private
- # @return [TracePoint]
+ # @sig TracePoint
attr_reader :tracer
# Asserts `cpath` corresponds to an explicit namespace for which `loader`
# is responsible.
#
# @private
- # @param cpath [String]
- # @param loader [Zeitwerk::Loader]
- # @return [void]
+ # @sig (String, Zeitwerk::Loader) -> void
def register(cpath, loader)
mutex.synchronize do
cpaths[cpath] = loader
@@ -42,19 +40,22 @@
end
# @private
- # @param loader [Zeitwerk::Loader]
- # @return [void]
+ # @sig (Zeitwerk::Loader) -> void
def unregister(loader)
cpaths.delete_if { |_cpath, l| l == loader }
disable_tracer_if_unneeded
end
+ private
+
+ # @sig () -> void
def disable_tracer_if_unneeded
mutex.synchronize do
tracer.disable if cpaths.empty?
end
end
+ # @sig (TracePoint) -> void
def tracepoint_class_callback(event)
# If the class is a singleton class, we won't do anything with it so we
# can bail out immediately. This is several orders of magnitude faster
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/zeitwerk/gem_inflector.rb
new/lib/zeitwerk/gem_inflector.rb
--- old/lib/zeitwerk/gem_inflector.rb 2020-07-15 00:11:04.000000000 +0200
+++ new/lib/zeitwerk/gem_inflector.rb 2020-10-29 11:34:25.000000000 +0100
@@ -2,16 +2,14 @@
module Zeitwerk
class GemInflector < Inflector
- # @param root_file [String]
+ # @sig (String) -> void
def initialize(root_file)
namespace = File.basename(root_file, ".rb")
lib_dir = File.dirname(root_file)
@version_file = File.join(lib_dir, namespace, "version.rb")
end
- # @param basename [String]
- # @param abspath [String]
- # @return [String]
+ # @sig (String, String) -> String
def camelize(basename, abspath)
abspath == @version_file ? "VERSION" : super
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/zeitwerk/inflector.rb
new/lib/zeitwerk/inflector.rb
--- old/lib/zeitwerk/inflector.rb 2020-07-15 00:11:04.000000000 +0200
+++ new/lib/zeitwerk/inflector.rb 2020-10-29 11:34:25.000000000 +0100
@@ -11,9 +11,7 @@
#
# Takes into account hard-coded mappings configured with `inflect`.
#
- # @param basename [String]
- # @param _abspath [String]
- # @return [String]
+ # @sig (String, String) -> String
def camelize(basename, _abspath)
overrides[basename] || basename.split('_').each(&:capitalize!).join
end
@@ -30,8 +28,7 @@
# inflector.camelize("mysql_adapter", abspath) # => "MySQLAdapter"
# inflector.camelize("users_controller", abspath) # => "UsersController"
#
- # @param inflections [{String => String}]
- # @return [void]
+ # @sig (Hash[String, String]) -> void
def inflect(inflections)
overrides.merge!(inflections)
end
@@ -41,7 +38,7 @@
# Hard-coded basename to constant name user maps that override the default
# inflection logic.
#
- # @return [{String => String}]
+ # @sig () -> Hash[String, String]
def overrides
@overrides ||= {}
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/zeitwerk/kernel.rb new/lib/zeitwerk/kernel.rb
--- old/lib/zeitwerk/kernel.rb 2020-07-15 00:11:04.000000000 +0200
+++ new/lib/zeitwerk/kernel.rb 2020-10-29 11:34:25.000000000 +0100
@@ -19,8 +19,7 @@
# already existing ancestor chains.
alias_method :zeitwerk_original_require, :require
- # @param path [String]
- # @return [Boolean]
+ # @sig (String) -> true | false
def require(path)
if loader = Zeitwerk::Registry.loader_for(path)
if path.end_with?(".rb")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/zeitwerk/loader/callbacks.rb
new/lib/zeitwerk/loader/callbacks.rb
--- old/lib/zeitwerk/loader/callbacks.rb 2020-07-15 00:11:04.000000000
+0200
+++ new/lib/zeitwerk/loader/callbacks.rb 2020-10-29 11:34:25.000000000
+0100
@@ -4,8 +4,7 @@
# Invoked from our decorated Kernel#require when a managed file is
autoloaded.
#
# @private
- # @param file [String]
- # @return [void]
+ # @sig (String) -> void
def on_file_autoloaded(file)
cref = autoloads.delete(file)
to_unload[cpath(*cref)] = [file, cref] if reloading_enabled?
@@ -22,8 +21,7 @@
# autoloaded.
#
# @private
- # @param dir [String]
- # @return [void]
+ # @sig (String) -> void
def on_dir_autoloaded(dir)
# Module#autoload does not serialize concurrent requires, and we handle
# directories ourselves, so the callback needs to account for concurrency.
@@ -59,8 +57,7 @@
# subdirectories, we descend into them now.
#
# @private
- # @param namespace [Module]
- # @return [void]
+ # @sig (Module) -> void
def on_namespace_loaded(namespace)
if subdirs = lazy_subdirs.delete(real_mod_name(namespace))
subdirs.each do |subdir|
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/zeitwerk/loader.rb new/lib/zeitwerk/loader.rb
--- old/lib/zeitwerk/loader.rb 2020-07-15 00:11:04.000000000 +0200
+++ new/lib/zeitwerk/loader.rb 2020-10-29 11:34:25.000000000 +0100
@@ -9,13 +9,13 @@
include Callbacks
include RealModName
- # @return [String]
+ # @sig String
attr_reader :tag
- # @return [#camelize]
+ # @sig #camelize
attr_accessor :inflector
- # @return [#call, #debug, nil]
+ # @sig #call | #debug | nil
attr_accessor :logger
# Absolute paths of the root directories. Stored in a hash to preserve
@@ -30,20 +30,20 @@
# interface for it is `push_dir` and `dirs`.
#
# @private
- # @return [{String => true}]
+ # @sig Hash[String, true]
attr_reader :root_dirs
# Absolute paths of files or directories that have to be preloaded.
#
# @private
- # @return [<String>]
+ # @sig Array[String]
attr_reader :preloads
# Absolute paths of files, directories, or glob patterns to be totally
# ignored.
#
# @private
- # @return [Set<String>]
+ # @sig Set[String]
attr_reader :ignored_glob_patterns
# The actual collection of absolute file and directory names at the time
the
@@ -51,20 +51,20 @@
# reload.
#
# @private
- # @return [Set<String>]
+ # @sig Set[String]
attr_reader :ignored_paths
# Absolute paths of directories or glob patterns to be collapsed.
#
# @private
- # @return [Set<String>]
+ # @sig Set[String]
attr_reader :collapse_glob_patterns
# The actual collection of absolute directory names at the time the
collapse
# glob patterns were expanded. Computed on setup, and recomputed on reload.
#
# @private
- # @return [Set<String>]
+ # @sig Set[String]
attr_reader :collapse_dirs
# Maps real absolute paths for which an autoload has been set ---and not
@@ -76,7 +76,7 @@
# ...
#
# @private
- # @return [{String => (Module, Symbol)}]
+ # @sig Hash[String, [Module, Symbol]]
attr_reader :autoloads
# We keep track of autoloaded directories to remove them from the registry
@@ -86,7 +86,7 @@
# to concurrency (see why in
Zeitwerk::Loader::Callbacks#on_dir_autoloaded).
#
# @private
- # @return [<String>]
+ # @sig Array[String]
attr_reader :autoloaded_dirs
# Stores metadata needed for unloading. Its entries look like this:
@@ -102,7 +102,7 @@
# or eager loaded. Otherwise, the collection remains empty.
#
# @private
- # @return [{String => (String, (Module, Symbol))}]
+ # @sig Hash[String, [String, [Module, Symbol]]]
attr_reader :to_unload
# Maps constant paths of namespaces to arrays of corresponding directories.
@@ -120,21 +120,21 @@
# up the corresponding autoloads.
#
# @private
- # @return [{String => <String>}]
+ # @sig Hash[String, Array[String]]
attr_reader :lazy_subdirs
# Absolute paths of files or directories not to be eager loaded.
#
# @private
- # @return [Set<String>]
+ # @sig Set[String]
attr_reader :eager_load_exclusions
# @private
- # @return [Mutex]
+ # @sig Mutex
attr_reader :mutex
# @private
- # @return [Mutex]
+ # @sig Mutex
attr_reader :mutex2
def initialize
@@ -170,7 +170,7 @@
# Sets a tag for the loader, useful for logging.
#
# @param tag [#to_s]
- # @return [void]
+ # @sig (#to_s) -> void
def tag=(tag)
@tag = tag.to_s
end
@@ -178,7 +178,7 @@
# Absolute paths of the root directories. This is a read-only collection,
# please push here via `push_dir`.
#
- # @return [<String>]
+ # @sig () -> Array[String]
def dirs
root_dirs.keys.freeze
end
@@ -189,10 +189,8 @@
# the same process already manages that directory or one of its ascendants
# or descendants.
#
- # @param path [<String, Pathname>]
- # @param namespace [Class, Module]
# @raise [Zeitwerk::Error]
- # @return [void]
+ # @sig (String | Pathname, Module) -> void
def push_dir(path, namespace: Object)
# Note that Class < Module.
unless namespace.is_a?(Module)
@@ -212,7 +210,7 @@
# There is no way to undo this, either you want to reload or you don't.
#
# @raise [Zeitwerk::Error]
- # @return [void]
+ # @sig () -> void
def enable_reloading
mutex.synchronize do
break if @reloading_enabled
@@ -225,15 +223,14 @@
end
end
- # @return [Boolean]
+ # @sig () -> bool
def reloading_enabled?
@reloading_enabled
end
# Files or directories to be preloaded instead of lazy loaded.
#
- # @param paths [<String, Pathname, <String, Pathname>>]
- # @return [void]
+ # @sig (*(String | Pathname | Array[String | Pathname])) -> void
def preload(*paths)
mutex.synchronize do
expand_paths(paths).each do |abspath|
@@ -245,8 +242,7 @@
# Configure files, directories, or glob patterns to be totally ignored.
#
- # @param paths [<String, Pathname, <String, Pathname>>]
- # @return [void]
+ # @sig (*(String | Pathname | Array[String | Pathname])) -> void
def ignore(*glob_patterns)
glob_patterns = expand_paths(glob_patterns)
mutex.synchronize do
@@ -257,8 +253,7 @@
# Configure directories or glob patterns to be collapsed.
#
- # @param paths [<String, Pathname, <String, Pathname>>]
- # @return [void]
+ # @sig (*(String | Pathname | Array[String | Pathname])) -> void
def collapse(*glob_patterns)
glob_patterns = expand_paths(glob_patterns)
mutex.synchronize do
@@ -269,7 +264,7 @@
# Sets autoloads in the root namespace and preloads files, if any.
#
- # @return [void]
+ # @sig () -> void
def setup
mutex.synchronize do
break if @setup
@@ -291,7 +286,7 @@
# unload them.
#
# @private
- # @return [void]
+ # @sig () -> void
def unload
mutex.synchronize do
# We are going to keep track of the files that were required by our
@@ -354,7 +349,7 @@
# client code in the README of the project.
#
# @raise [Zeitwerk::Error]
- # @return [void]
+ # @sig () -> void
def reload
if reloading_enabled?
unload
@@ -371,7 +366,7 @@
# are not eager loaded. You can opt-out specifically in specific files and
# directories with `do_not_eager_load`.
#
- # @return [void]
+ # @sig () -> void
def eager_load
mutex.synchronize do
break if @eager_loaded
@@ -414,8 +409,7 @@
# Let eager load ignore the given files or directories. The constants
# defined in those files are still autoloadable.
#
- # @param paths [<String, Pathname, <String, Pathname>>]
- # @return [void]
+ # @sig (*(String | Pathname | Array[String | Pathname])) -> void
def do_not_eager_load(*paths)
mutex.synchronize { eager_load_exclusions.merge(expand_paths(paths)) }
end
@@ -423,8 +417,7 @@
# Says if the given constant path would be unloaded on reload. This
# predicate returns `false` if reloading is disabled.
#
- # @param cpath [String]
- # @return [Boolean]
+ # @sig (String) -> bool
def unloadable_cpath?(cpath)
to_unload.key?(cpath)
end
@@ -432,21 +425,20 @@
# Returns an array with the constant paths that would be unloaded on
reload.
# This predicate returns an empty array if reloading is disabled.
#
- # @return [<String>]
+ # @sig () -> Array[String]
def unloadable_cpaths
to_unload.keys.freeze
end
# Logs to `$stdout`, handy shortcut for debugging.
#
- # @return [void]
+ # @sig () -> void
def log!
@logger = ->(msg) { puts msg }
end
# @private
- # @param dir [String]
- # @return [Boolean]
+ # @sig (String) -> bool
def manages?(dir)
dir = dir + "/"
ignored_paths.each do |ignored_path|
@@ -463,11 +455,11 @@
# --- Class methods
---------------------------------------------------------------------------
class << self
- # @return [#call, #debug, nil]
+ # @sig #call | #debug | nil
attr_accessor :default_logger
# @private
- # @return [Mutex]
+ # @sig Mutex
attr_accessor :mutex
# This is a shortcut for
@@ -481,7 +473,7 @@
# except that this method returns the same object in subsequent calls
from
# the same file, in the unlikely case the gem wants to be able to reload.
#
- # @return [Zeitwerk::Loader]
+ # @sig () -> Zeitwerk::Loader
def for_gem
called_from = caller_locations(1, 1).first.path
Registry.loader_for_gem(called_from)
@@ -489,7 +481,7 @@
# Broadcasts `eager_load` to all loaders.
#
- # @return [void]
+ # @sig () -> void
def eager_load_all
Registry.loaders.each(&:eager_load)
end
@@ -497,7 +489,7 @@
# Returns an array with the absolute paths of the root directories of all
# registered loaders. This is a read-only collection.
#
- # @return [<String>]
+ # @sig () -> Array[String]
def all_dirs
Registry.loaders.flat_map(&:dirs).freeze
end
@@ -507,16 +499,14 @@
private #
-------------------------------------------------------------------------------------
- # @return [<String>]
+ # @sig () -> Array[String]
def actual_root_dirs
root_dirs.reject do |root_dir, _namespace|
!dir?(root_dir) || ignored_paths.member?(root_dir)
end
end
- # @param dir [String]
- # @param parent [Module]
- # @return [void]
+ # @sig (String, Module) -> void
def set_autoloads_in_dir(dir, parent)
ls(dir) do |basename, abspath|
begin
@@ -559,10 +549,7 @@
end
end
- # @param parent [Module]
- # @param cname [Symbol]
- # @param subdir [String]
- # @return [void]
+ # @sig (Module, Symbol, String) -> void
def autoload_subdir(parent, cname, subdir)
if autoload_path = autoload_for?(parent, cname)
cpath = cpath(parent, cname)
@@ -582,10 +569,7 @@
end
end
- # @param parent [Module]
- # @param cname [Symbol]
- # @param file [String]
- # @return [void]
+ # @sig (Module, Symbol, String) -> void
def autoload_file(parent, cname, file)
if autoload_path = autoload_for?(parent, cname)
# First autoload for a Ruby file wins, just ignore subsequent ones.
@@ -606,11 +590,10 @@
end
end
- # @param dir [String] directory that would have autovivified a module
- # @param file [String] the file where the namespace is explicitly defined
- # @param parent [Module]
- # @param cname [Symbol]
- # @return [void]
+ # `dir` is the directory that would have autovivified a namespace. `file`
is
+ # the file where we've found the namespace is explicitly defined.
+ #
+ # @sig (dir: String, file: String, parent: Module, cname: Symbol) -> void
def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:,
cname:)
autoloads.delete(dir)
Registry.unregister_autoload(dir)
@@ -619,10 +602,7 @@
register_explicit_namespace(cpath(parent, cname))
end
- # @param parent [Module]
- # @param cname [Symbol]
- # @param abspath [String]
- # @return [void]
+ # @sig (Module, Symbol, String) -> void
def set_autoload(parent, cname, abspath)
# $LOADED_FEATURES stores real paths since Ruby 2.4.4. We set and save
the
# real path to be able to delete it from $LOADED_FEATURES on unload, and
to
@@ -649,9 +629,7 @@
end
end
- # @param parent [Module]
- # @param cname [Symbol]
- # @return [String, nil]
+ # @sig (Module, Symbol) -> String?
def autoload_for?(parent, cname)
strict_autoload_path(parent, cname) || Registry.inception?(cpath(parent,
cname))
end
@@ -672,9 +650,7 @@
#
# We need a way to strictly check in parent ignoring ancestors.
#
- # @param parent [Module]
- # @param cname [Symbol]
- # @return [String, nil]
+ # @sig (Module, Symbol) -> String?
if method(:autoload?).arity == 1
def strict_autoload_path(parent, cname)
parent.autoload?(cname) if cdef?(parent, cname)
@@ -688,15 +664,14 @@
# This method is called this way because I prefer `preload` to be the
method
# name to configure preloads in the public interface.
#
- # @return [void]
+ # @sig () -> void
def do_preload
preloads.each do |abspath|
do_preload_abspath(abspath)
end
end
- # @param abspath [String]
- # @return [void]
+ # @sig (String) -> void
def do_preload_abspath(abspath)
if ruby?(abspath)
do_preload_file(abspath)
@@ -705,31 +680,25 @@
end
end
- # @param dir [String]
- # @return [void]
+ # @sig (String) -> void
def do_preload_dir(dir)
ls(dir) do |_basename, abspath|
do_preload_abspath(abspath)
end
end
- # @param file [String]
- # @return [Boolean]
+ # @sig (String) -> bool
def do_preload_file(file)
log("preloading #{file}") if logger
require file
end
- # @param parent [Module]
- # @param cname [Symbol]
- # @return [String]
+ # @sig (Module, Symbol) -> String
def cpath(parent, cname)
parent.equal?(Object) ? cname.to_s : "#{real_mod_name(parent)}::#{cname}"
end
- # @param dir [String]
- # @yieldparam path [String, String]
- # @return [void]
+ # @sig (String) { (String, String) -> void } -> void
def ls(dir)
Dir.foreach(dir) do |basename|
next if basename.start_with?(".")
@@ -743,57 +712,55 @@
end
end
- # @param path [String]
- # @return [Boolean]
+ # @sig (String) -> bool
def ruby?(path)
path.end_with?(".rb")
end
- # @param path [String]
- # @return [Boolean]
+ # @sig (String) -> bool
def dir?(path)
File.directory?(path)
end
- # @param paths [<String, Pathname, <String, Pathname>>]
- # @return [<String>]
+ # @sig (String | Pathname | Array[String | Pathname]) -> Array[String]
def expand_paths(paths)
paths.flatten.map! { |path| File.expand_path(path) }
end
- # @param glob_patterns [<String>]
- # @return [<String>]
+ # @sig (Array[String]) -> Array[String]
def expand_glob_patterns(glob_patterns)
# Note that Dir.glob works with regular file names just fine. That is,
# glob patterns technically need no wildcards.
glob_patterns.flat_map { |glob_pattern| Dir.glob(glob_pattern) }
end
- # @return [void]
+ # @sig () -> void
def recompute_ignored_paths
ignored_paths.replace(expand_glob_patterns(ignored_glob_patterns))
end
- # @return [void]
+ # @sig () -> void
def recompute_collapse_dirs
collapse_dirs.replace(expand_glob_patterns(collapse_glob_patterns))
end
- # @param message [String]
- # @return [void]
+ # @sig (String) -> void
def log(message)
method_name = logger.respond_to?(:debug) ? :debug : :call
logger.send(method_name, "Zeitwerk@#{tag}: #{message}")
end
+ # @sig (Module, Symbol) -> bool
def cdef?(parent, cname)
parent.const_defined?(cname, false)
end
+ # @sig (String) -> void
def register_explicit_namespace(cpath)
ExplicitNamespace.register(cpath, self)
end
+ # @sig (String) -> void
def raise_if_conflicting_directory(dir)
self.class.mutex.synchronize do
Registry.loaders.each do |loader|
@@ -808,19 +775,15 @@
end
end
- # @param parent [Module]
- # @param cname [Symbol]
- # @return [void]
+ # @sig (Module, Symbol) -> void
def unload_autoload(parent, cname)
- parent.send(:remove_const, cname)
+ parent.__send__(:remove_const, cname)
log("autoload for #{cpath(parent, cname)} removed") if logger
end
- # @param parent [Module]
- # @param cname [Symbol]
- # @return [void]
+ # @sig (Module, Symbol) -> void
def unload_cref(parent, cname)
- parent.send(:remove_const, cname)
+ parent.__send__(:remove_const, cname)
log("#{cpath(parent, cname)} unloaded") if logger
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/zeitwerk/real_mod_name.rb
new/lib/zeitwerk/real_mod_name.rb
--- old/lib/zeitwerk/real_mod_name.rb 2020-07-15 00:11:04.000000000 +0200
+++ new/lib/zeitwerk/real_mod_name.rb 2020-10-29 11:34:25.000000000 +0100
@@ -7,8 +7,7 @@
#
# The name method can be overridden, hence the indirection in this method.
#
- # @param mod [Class, Module]
- # @return [String, nil]
+ # @sig (Module) -> String?
if UnboundMethod.method_defined?(:bind_call)
def real_mod_name(mod)
UNBOUND_METHOD_MODULE_NAME.bind_call(mod)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/zeitwerk/registry.rb new/lib/zeitwerk/registry.rb
--- old/lib/zeitwerk/registry.rb 2020-07-15 00:11:04.000000000 +0200
+++ new/lib/zeitwerk/registry.rb 2020-10-29 11:34:25.000000000 +0100
@@ -7,14 +7,14 @@
# them from being garbage collected.
#
# @private
- # @return [<Zeitwerk::Loader>]
+ # @sig Array[Zeitwerk::Loader]
attr_reader :loaders
# Registers loaders created with `for_gem` to make the method idempotent
# in case of reload.
#
# @private
- # @return [{String => Zeitwerk::Loader}]
+ # @sig Hash[String, Zeitwerk::Loader]
attr_reader :loaders_managing_gems
# Maps real paths to the loaders responsible for them.
@@ -23,7 +23,7 @@
# invoke callbacks and autovivify modules.
#
# @private
- # @return [{String => Zeitwerk::Loader}]
+ # @sig Hash[String, Zeitwerk::Loader]
attr_reader :autoloads
# This hash table addresses an edge case in which an autoload is ignored.
@@ -62,14 +62,13 @@
# end
#
# @private
- # @return [{String => (String, Zeitwerk::Loader)}]
+ # @sig Hash[String, [String, Zeitwerk::Loader]]
attr_reader :inceptions
# Registers a loader.
#
# @private
- # @param loader [Zeitwerk::Loader]
- # @return [void]
+ # @sig (Zeitwerk::Loader) -> void
def register_loader(loader)
loaders << loader
end
@@ -78,8 +77,7 @@
# file. That is how Zeitwerk::Loader.for_gem is idempotent.
#
# @private
- # @param root_file [String]
- # @return [Zeitwerk::Loader]
+ # @sig (String) -> Zeitwerk::Loader
def loader_for_gem(root_file)
loaders_managing_gems[root_file] ||= begin
Loader.new.tap do |loader|
@@ -91,32 +89,25 @@
end
# @private
- # @param loader [Zeitwerk::Loader]
- # @param realpath [String]
- # @return [void]
+ # @sig (Zeitwerk::Loader, String) -> String
def register_autoload(loader, realpath)
autoloads[realpath] = loader
end
# @private
- # @param realpath [String]
- # @return [void]
+ # @sig (String) -> void
def unregister_autoload(realpath)
autoloads.delete(realpath)
end
# @private
- # @param cpath [String]
- # @param realpath [String]
- # @param loader [Zeitwerk::Loader]
- # @return [void]
+ # @sig (String, String, Zeitwerk::Loader) -> void
def register_inception(cpath, realpath, loader)
inceptions[cpath] = [realpath, loader]
end
# @private
- # @param cpath [String]
- # @return [String, nil]
+ # @sig (String) -> String?
def inception?(cpath)
if pair = inceptions[cpath]
pair.first
@@ -124,15 +115,13 @@
end
# @private
- # @param path [String]
- # @return [Zeitwerk::Loader, nil]
+ # @sig (String) -> Zeitwerk::Loader?
def loader_for(path)
autoloads[path]
end
# @private
- # @param loader [Zeitwerk::Loader]
- # @return [void]
+ # @sig (Zeitwerk::Loader) -> void
def on_unload(loader)
autoloads.delete_if { |_path, object| object == loader }
inceptions.delete_if { |_cpath, (_path, object)| object == loader }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/zeitwerk/version.rb new/lib/zeitwerk/version.rb
--- old/lib/zeitwerk/version.rb 2020-07-15 00:11:04.000000000 +0200
+++ new/lib/zeitwerk/version.rb 2020-10-29 11:34:25.000000000 +0100
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Zeitwerk
- VERSION = "2.4.0"
+ VERSION = "2.4.1"
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2020-07-15 00:11:04.000000000 +0200
+++ new/metadata 2020-10-29 11:34:25.000000000 +0100
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: zeitwerk
version: !ruby/object:Gem::Version
- version: 2.4.0
+ version: 2.4.1
platform: ruby
authors:
- Xavier Noria
-autorequire:
+autorequire:
bindir: bin
cert_chain: []
-date: 2020-07-14 00:00:00.000000000 Z
+date: 2020-10-29 00:00:00.000000000 Z
dependencies: []
description: |2
Zeitwerk implements constant autoloading with Ruby semantics. Each gem
@@ -41,7 +41,7 @@
changelog_uri: https://github.com/fxn/zeitwerk/blob/master/CHANGELOG.md
source_code_uri: https://github.com/fxn/zeitwerk
bug_tracker_uri: https://github.com/fxn/zeitwerk/issues
-post_install_message:
+post_install_message:
rdoc_options: []
require_paths:
- lib
@@ -57,7 +57,7 @@
version: '0'
requirements: []
rubygems_version: 3.1.2
-signing_key:
+signing_key:
specification_version: 4
summary: Efficient and thread-safe constant autoloader
test_files: []