Sha256: 5e4cb58fd2e3eec6b6ae9282b0e97d9b203bf4827bd620ff96e7c679e51a60b6
Contents?: true
Size: 506 Bytes
Versions: 3
Compression:
Stored size: 506 Bytes
Contents
# typed: strict class SerializeValue extend T::Sig sig { params(value: T.untyped).returns(T.untyped) } def self.serialize(value) if value.is_a?(Hash) HashTransformer.serialize_values(value) elsif value.is_a?(Array) value.map { |item| serialize(item) } elsif value.is_a?(T::Struct) value.serialize_to(:hash, options: {should_serialize_values: true}).payload_or(value) elsif value.respond_to?(:serialize) value.serialize else value end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sorbet-schema-0.9.2 | lib/sorbet-schema/serialize_value.rb |
sorbet-schema-0.9.1 | lib/sorbet-schema/serialize_value.rb |
sorbet-schema-0.9.0 | lib/sorbet-schema/serialize_value.rb |