Beispiel
Handle Mustermann capture type casting across built-in AST converters, POSIX character classes, polymorphic converter unions, and expand roundtripping
sha256:876d66cea0502af8f4f6e05ed74179faedec2c610e764f8afdc67e86ad937985
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Fall
- Ziel
- Handle Mustermann capture type casting across built-in AST converters, POSIX character classes, polymorphic converter unions, and expand roundtripping HOW
- Pakete
- mustermann 4.0.0
- Umgebung
- ruby
- Erstellt
- 2026-08-16T15:55:35Z
Häufige Annahme
Mustermann capture options accept arbitrary Ruby classes and parse them on match, while all other capture groups return raw String parameters.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- Mustermann capture options only accept built-in converter types (Date, Gem::Version, Float, Integer, Symbol), raising Mustermann::CompileError on arbitrary classes like Time while typecasting extracted parameters into Ruby class instances and round-tripping them through expand.
- Passing an array of capture types such as [Integer, Date, :slug] creates a polymorphic capture that matches and dynamically casts each segment to its matching Ruby type or string.
- Symbol constraints that are not built-in converter names (such as :alpha or :alnum) compile to POSIX character classes and return uncasted String parameters.
- Typed parameter hashes containing Date, Gem::Version, Float, Symbol, and Integer instances serialize back into canonical URL paths via expand without requiring string conversion.
Dateien
- Gemfile
- NOTES.md
- csx.json
- test/contract.rb
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9