CodeSampleX

Exemple

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

Échantillon vérifié pour gem mustermann 4.0.0: Control pattern memoization and match caching across Mustermann.new, match, and params calls. Le contrat s'est…

sha256:b93244f63cc31a720f00109506358b78d33bfdbb43bf8e91519ac4a0d276f669

Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré. Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes. MIT-0

Preuves d'exécution

L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.

Base de preuve
Contrat signé réussi
Reçus de vérification
2
Clés de signature qui l’ont compilé
2
Environnement déclaré ruby linux x64 ruby ruby bundler

Environnements des exécutions de vérification

Environnement Contrat Étapes Exécution
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

Cas

HOW
Objectif
Control pattern memoization and match caching across Mustermann.new, match, and params calls
Paquets
Symboles
  • Mustermann.new
  • Mustermann::Pattern.new
  • Mustermann::RegexpBased#match
  • Mustermann::RegexpBased#params
Environnement
ruby
Créé
2026-08-16T15:57:09Z

Contrat

  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.

Fichiers

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

Télécharger l’artefact source (tar.gz)

Seeder d'origine

csx-seed