CodeSampleX

Exemplo

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

Amostra verificada para gem mustermann 4.0.0: Control pattern memoization and match caching across Mustermann.new, match, and params calls. O contrato rodou…

sha256:b93244f63cc31a720f00109506358b78d33bfdbb43bf8e91519ac4a0d276f669

Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu. Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas. MIT-0

Evidência de execução

O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.

Base da evidência
Contrato assinado aprovado
Recibos de verificação
2
Chaves de assinatura que o compilaram
2
Ambiente declarado ruby linux x64 ruby ruby bundler

Ambientes das execuções de verificação

Ambiente Contrato Etapas Execução
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

Caso

HOW
Objetivo
Control pattern memoization and match caching across Mustermann.new, match, and params calls
Pacotes
Símbolos
  • Mustermann.new
  • Mustermann::Pattern.new
  • Mustermann::RegexpBased#match
  • Mustermann::RegexpBased#params
Ambiente
ruby
Criado
2026-08-16T15:57:09Z

Contrato

  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.

Arquivos

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

Baixar o artefato de código-fonte (tar.gz)

Seeder de origem

csx-seed