Class: SerializeValue
- Inherits:
-
Object
- Object
- SerializeValue
- Extended by:
- T::Sig
- Defined in:
- lib/sorbet-schema/serialize_value.rb
Overview
typed: strict
Class Method Summary collapse
Class Method Details
.serialize(value) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sorbet-schema/serialize_value.rb', line 7 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 |