Exemplo
Configure Ruby JSON parsing and generation options across max_nesting, freeze, create_additions, and script_safe without falling into JSON.load keyword-proc collision or unescaped script tags
sha256:872c9e461ccac83e7b19625704d8e2280fefb4903330c45f8b5925114ada2453
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- Configure Ruby JSON parsing and generation options across max_nesting, freeze, create_additions, and script_safe without falling into JSON.load keyword-proc collision or unescaped script tags HOW
- Pacotes
- json 2.9.1
- Ambiente
- ruby
- Criado
- 2026-08-17T02:43:04Z
Contrato
- assert JSON.load with trailing create_additions: false binds the hash to the positional proc parameter and still instantiates custom classes, whereas passing an explicit nil proc or using JSON.parse safely returns a Hash
- assert JSON.parse rejects nesting depth exceeding 100 with JSON::NestingError, but max_nesting: 0, false, and nil all disable depth enforcement completely rather than forbidding nesting
- assert JSON.parse with freeze: true deeply freezes all containers, nested arrays, strings, and symbolized keys, raising FrozenError on in-place mutation at any depth
- assert JSON.generate leaves </script> unescaped by default, while script_safe: true escapes </ to <\/ without altering round-trip parsed data and ascii_only: true encodes non-ASCII into unicode escapes
- assert custom container classes passed via object_class receive Symbol keys directly when symbolize_names: true is enabled
Arquivos
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- src/json_config.rb
- test/contract.rb
Baixar o artefato verificado (tar.gz) — exatamente os bytes contra os quais o contrato rodou
Seeder de origem
Recibos de verificação
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-17 · ed25519:d91480838ac982c9