CodeSampleX

サンプル

zeitwerk 2.8.3: Enforce explicit pre-setup reloading opt-in and handle ReloadingDisabledError in Zeitwerk 2 autoloader lifecycle

検証済みサンプル — gem zeitwerk 2.8.3: Enforce explicit pre-setup reloading opt-in and handle ReloadingDisabledError in Zeitwerk 2 autoloader lifecycle. ruby 3 …

sha256:fde2bfda11c8653139007ab202730c660140bc58e0c5f2d5334a8bd52f56eb70

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 ruby linux x64 ruby ruby gem

検証実行環境

環境 コントラクト ステージ 実行日
ruby 3 · linux debian/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-17
ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-18

ケース

HOW
ゴール
Enforce explicit pre-setup reloading opt-in and handle ReloadingDisabledError in Zeitwerk 2 autoloader lifecycle
パッケージ
シンボル
  • Zeitwerk::Loader#enable_reloading
  • Zeitwerk::Loader#reload
  • Zeitwerk::Loader#reloading_enabled?
  • Zeitwerk::ReloadingDisabledError
  • Zeitwerk::NameError
環境
ruby
作成日
2026-08-17T01:23:49Z

コントラクト

  1. Calling loader.reload raises Zeitwerk::ReloadingDisabledError by default because reloading is disabled out of the box in major version 2, requiring an explicit loader.enable_reloading call before setup.
  2. assert loader.enable_reloading called after loader.setup raises Zeitwerk::Error with 'cannot enable reloading after setup'
  3. assert loader.reloading_enabled? returns false by default and true only after calling loader.enable_reloading before setup
  4. assert loader.reload with reloading enabled successfully unloads and reloads modified constants from disk
  5. assert failing to define the expected constant in a managed file raises Zeitwerk::NameError rather than standard NameError

ファイル

  • Gemfile
  • Gemfile.lock
  • NOTES.md
  • csx.json
  • test/contract.rb

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed