./devel/ruby-zeitwerk, Efficient and thread-safe constant autoloader

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 2.6.13, Package name: ruby31-zeitwerk-2.6.13, Maintainer: pkgsrc-users

Zeitwerk is an efficient and thread-safe code loader for Ruby.

Given a conventional file structure, Zeitwerk is able to load your project's
classes and modules on demand (autoloading), or upfront (eager loading). You
don't need to write `require` calls for your own files, rather, you can
streamline your programming knowing that your classes and modules are
available everywhere. This feature is efficient, thread-safe, and matches
Ruby's semantics for constants.

Zeitwerk is also able to reload code, which may be handy while developing web
applications. Coordination is needed to reload in a thread-safe manner. The
documentation below explains how to do this.


Required to run:
[lang/ruby26-base]

Required to build:
[pkgtools/cwrappers]

Master sites:

Filesize: 38 KB

Version history: (Expand)


CVS history: (Expand)


   2024-02-06 16:05:38 by Takahiro Kambe | Files touched by this commit (3) | Package updated
Log message:
devel/ruby-zeitwerk: update to 2.6.13

2.6.13 (2024-02-06)

* There is a new experimental null inflector that simply returns its input
  unchanged:

    loader.inflector = Zeitwerk::NullInflector.new

  Projects using this inflector are expected to define their constants in
  files and directories with names exactly matching them:

    User.rb       -> User
    HTMLParser.rb -> HTMLParser
    Admin/Role.rb -> Admin::Role

  Please see its documentation for further details.

* Documentation improvements.
   2023-11-11 13:34:05 by Takahiro Kambe | Files touched by this commit (2) | Package updated
Log message:
devel/ruby-zeitwerk: update to 2.6.12

2.6.12 (2023-09-25)

* Maintenance release with some internal polishing.
   2023-08-05 10:57:31 by Takahiro Kambe | Files touched by this commit (2) | Package updated
Log message:
devel/ruby-zeitwerk: update to 2.6.11

2.6.10 (2023-07-30)

* Improve validation of the values returned by the inflector's camelize.

2.6.11 (2023-08-02)

* Let on_load callbacks for implicit namespaces autoload other implicit
  namespaces.
   2023-07-30 06:09:01 by Takahiro Kambe | Files touched by this commit (2) | Package updated
Log message:
devel/ruby-zeitwerk: update to 2.6.9

2.6.9 (2023-07-25)

* Given a path as a string or Pathname object,
  Zeitwerk::Loader#cpath_expected_at returns a string with the corresponding
  expected constant path.

  Some examples, assuming that app/models is a root directory:

    loader.cpath_expected_at("app/models")                  # => \ 
"Object"
    loader.cpath_expected_at("app/models/user.rb")          # => \ 
"User"
    loader.cpath_expected_at("app/models/hotel")            # => \ 
"Hotel"
    loader.cpath_expected_at("app/models/hotel/billing.rb") # => \ 
"Hotel::Billing"

  This method returns nil for some input like ignored files, and may raise
  errors too.  Please check its documentation for further details.

* Zeitwerk::Loader#load_file raises with a more informative error if given a
  hidden file or directory.

* Zeitwerk::Loader#eager_load_dir does nothing if the argument is a hidden
  file or directory.  This is coherent with its existing behavior for eager
  load exclusions and ignored paths.  Before, that kind of argument would
  result in a non-deliberate NameError.

* Documentation improvements.
   2023-04-29 15:41:52 by Takahiro Kambe | Files touched by this commit (2) | Package updated
Log message:
devel/ruby-zeitwerk: update to 2.6.8

2.6.8 (2023-04-28)

* The new Zeitwerk::Loader.for_gem_extension gives you a loader configured
  according to the conventions of a gem extension.

* Please check its documentation for further details.
   2023-02-11 14:48:12 by Takahiro Kambe | Files touched by this commit (2) | Package updated
Log message:
devel/ruby-zeitwerk: update to 2.6.7

2.6.7 (2023-02-10)

* Reset module state on Zeitwerk::NameError.

  If an autoload is triggered, the file is loaded successfully, but the
  expected constant does not get defined, Ruby resets the state of the
  module.  In particular, autoload? returns nil for that constant name, and
  constants does not include the constant name (starting with Ruby 3.1).

  Zeitwerk is more strict, not defining the expected constant is an error
  condition and the loader raises Zeitwerk::NameError.  But this happens
  during the require call and the exception prevents Ruby from doing that
  cleanup.

  With this change, the parent module is left in a state that makes more
  sense and is consistent with what Ruby does.

* A message is logged if an autoload did not define the expected constant.

  When that happens, Zeitwerk::NameError is raised and you normally see the
  exception.  But if the error is shallowed, and you are inspecting the logs
  to investigate something, this new message may be helpful.

* By default, Zeitwerk::Loader#dirs filters ignored root directories
  out. Please, pass ignored: true if you want them included.

  It is very strange to configure a root directory and also ignore it, the
  edge case is supported only for completeness.  However, in that case,
  client code listing root directories rarely needs the ignored ones.

* Documentation improvements.

* Enforcement of private interfaces continues with another gradual patch.
   2022-11-30 15:31:42 by Takahiro Kambe | Files touched by this commit (3) | Package updated
Log message:
devel/ruby-zeitwerk: update to 2.6.6

2.6.2 (2022-10-31)

* Zeitwerk::Loader#load_file allows you to load an individual Ruby file.
  Check its documentation for details.

* Zeitwerk::Loader#eager_load_dir allows you to eager load a directory,
  recursively.  Check its documentation for details.

* Zeitwerk::Loader#eager_load_namespace allows you to eager a namespace,
  recursively.  Namespaces are global, this method loads only what the
  receiver manages from that namespace, if anything.  Check its
  documentation for details.

* Zeitwerk::Loader.eager_load_namespace broadcasts eager_load_namespace to
  all registered loaders.  Check its documentation for details.

* Documents shadowed files.  They always existed, but were not covered by
  the documentation.

* Other assorted documentation improvements.

2.6.3 (2022-10-31)

* v2.6.2 introduced a regression in the logic that checks whether two
  loaders want to manage the same root directories.  It has been fixed.

2.6.4 (2022-11-01)

Ruby does not have gem-level visibility, so sometimes you need things to be
public for them to be accessible internally.  But they do not belong to the
public interface of the gem.

A method that is undocumented and marked as @private in the source code is
clearly private API, regardless of its formal Ruby visibility.

This release starts a series of gradual patches in which private interface
is enforced with stricter formal visibility.

2.6.5 (2022-11-06)

* Controlled errors in a couple of situations:

  o Attempting to eager load or reload without previously invoking setup now
    raises Zeitwerk::SetupRequired.

  o The method Zeitwerk::Loader#push_dir raises Zeitwerk::Error if it gets
    an anonymous custom namespace.

* These should be backwards compatible, because they raise in circumstances
  that didn't work anyway.  The goal here is to provide a meaningful error
  upfront.

* Enforcement of private interfaces continues with another gradual patch.

2.6.6 (2022-11-08)

* The new eager_load_namespace had a bug when eager loading certain
  namespaces with collapsed directories.  This has been fixed.
   2022-10-09 09:37:47 by Takahiro Kambe | Files touched by this commit (2) | Package updated
Log message:
devel/ruby-zeitwerk: update to 2.6.1

2.6.1 (2022-10-01)

* Zeitwerk::Loader#dirs allows you to instrospect the root directories
  configured in the receiver. Please check its documentation for details.