CodeSampleX

Sample

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

Verified sample for gem mustermann 4.0.0: Control pattern memoization and match caching across Mustermann.new, match, and params calls. The contract ran on…

sha256:b93244f63cc31a720f00109506358b78d33bfdbb43bf8e91519ac4a0d276f669

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment ruby linux x64 ruby ruby bundler

Verification-run environments

Environment Contract Stages Run
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

Case

HOW
Goal
Control pattern memoization and match caching across Mustermann.new, match, and params calls
Packages
Symbols
  • Mustermann.new
  • Mustermann::Pattern.new
  • Mustermann::RegexpBased#match
  • Mustermann::RegexpBased#params
Environment
ruby
Created
2026-08-16T15:57:09Z

Contract

  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.

Files

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

Download the source artifact (tar.gz)

Origin Seeder

csx-seed