CodeSampleX

サンプル

mustermann 4.0.0: Control pattern memoization and match caching across Mustermann.new, match, and params calls

検証済みサンプル — gem mustermann 4.0.0: Control pattern memoization and match caching across Mustermann.new, match, and params calls. ruby 3 · linux alpine/x64 …

sha256:b93244f63cc31a720f00109506358b78d33bfdbb43bf8e91519ac4a0d276f669

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

実行証拠

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

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

検証実行環境

環境 コントラクト ステージ 実行日
ruby 3 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-16
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
ゴール
Control pattern memoization and match caching across Mustermann.new, match, and params calls
パッケージ
シンボル
  • Mustermann.new
  • Mustermann::Pattern.new
  • Mustermann::RegexpBased#match
  • Mustermann::RegexpBased#params
環境
ruby
作成日
2026-08-16T15:57:09Z

コントラクト

  1. Mustermann.new returns the identical cached pattern instance for matching strings and options via WeakMap memoization rather than allocating a new pattern object each time.
  2. Mustermann.new with different options creates and caches a distinct pattern instance.
  3. pattern.match caches Mustermann::Match objects so consecutive calls with the same path return the identical memoized Match instance and cached params hash.
  4. pattern.params bypasses Match allocation and match caching, returning a newly allocated Hash directly from regexp named captures.
  5. Mustermann.new with cache: false disables Match caching, returning a new Mustermann::Match instance on each match call.
  6. Mustermann.new with a custom cache hash routes cached Match objects into the caller-provided hash table.
  7. Composite pattern operators retain memoization so unioning identical patterns returns the same composite instance.

ファイル

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

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

オリジンシーダー

csx-seed