Skip to content

Revive Backload for Ruby 3 - #6

Merged
trans merged 1 commit into
masterfrom
revive
Nov 26, 2026
Merged

trans merged 1 commit into
masterfrom
revive

Conversation

@trans

@trans trans commented Nov 25, 2026

Copy link
Copy Markdown
Member

Backload's require and load callbacks still worked on current Ruby, but the require_relative one raised ("Can't parse"), because it read the directory out of backtrace text whose format has changed.

What's new

What changed underneath

  • The hooks are put in front of Kernel's methods with Module#prepend instead of alias chains. require and friends stay private on objects and public on Kernel.
  • require_relative takes its directory from caller_locations, and is always on. backload/require_relative, backload/require and backload/load remain as files that just load Backload.
  • The callbacks are no longer predefined as empty methods, so defining one doesn't warn of a method redefined.
  • An autoload is seen as the require it makes (tested).

Packaging and tests

  • backload.gemspec, Rakefile, CI on Ruby 3.1 to 4.0; version 0.3.0 (unreleased).
  • 17 tests on Spectrum, replacing the MicroTest ones.

The README is rewritten, which also takes in the typo fix from #3.

🤖 Generated with Claude Code

The hooks are prepended to Kernel instead of aliased. There is a callback
before each load as well as after, a nesting depth, and a trace file that
prints loads as a tree. The require_relative callback, which no longer
worked, takes its directory from caller_locations and is always on.
Packaging moves to a gemspec, and the tests to Spectrum.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@trans
trans merged commit d3404ca into master Nov 26, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant