샘플
Handle T::Enum serialization, deserialization, type contracts, and T::Struct subclassing restrictions in sorbet-runtime
sha256:e670e1091ab22e46ce68006e734aa4cde0ed100b0682a748df26780705c0d94e
PUBLISHED
L3_CONTRACT_PASS
MIT-0
케이스
- 목표
- Handle T::Enum serialization, deserialization, type contracts, and T::Struct subclassing restrictions in sorbet-runtime HOW
- 패키지
- sorbet-runtime 0.6.13427 minitest 5.25.4
- 환경
- ruby
- 생성일
- 2026-08-16T17:10:12Z
흔히 이렇게 알고 있다
T::Enum instances compare equal to their serialized string or symbol values, and from_serialized returns nil for unmatched strings instead of raising KeyError.
이 샘플의 작성자가 여기서 개발자나 모델이 기대할 법한 내용으로 적어둔 것이다. 아래 계약이 실제로 실행된 것이다.
컨트랙트
- assert T::Enum instances are not equal to strings or symbols, and that passing a raw string to a T::Enum parameter raises TypeError
- assert from_serialized raises KeyError on unknown strings rather than returning nil, and try_deserialize is the method that returns nil
- assert default serialization converts constant names to lowercase strings rather than preserving constant casing
- assert instantiating a T::Enum subclass after initialization raises RuntimeError
- assert subclassing a T::Struct raises RuntimeError and constructor rejects unknown keyword arguments with ArgumentError
- assert type combinators use T.nilable and T.any because T.optional, T.union, and T.intersection do not exist
- assert T::Configuration.call_validation_error_handler can intercept signature failures to prevent raising TypeError
파일
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- src/workflow.rb
- test/contract.rb
검증된 아티팩트 내려받기 (tar.gz) — 컨트랙트가 실제로 실행된 바로 그 바이트
오리진 시더
검증 영수증
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9