Runtime assertions for Ruby literal.fun
ruby
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

The serialization context should materialize deferred types

+8
+4
lib/literal/serialization_context.rb
··· 22 22 attr_reader :kind 23 23 24 24 def serialize(value, type:, strict: true) 25 + type = type.materialize if type in Literal::Types::DeferredType 26 + 25 27 serializer = serializer_for_type(type) 26 28 27 29 if strict && !(type === value) ··· 38 40 end 39 41 40 42 def deserialize(value, type:, strict: true) 43 + type = type.materialize if type in Literal::Types::DeferredType 44 + 41 45 serializer = serializer_for_type(type) 42 46 43 47 if strict && !(_JSONData === value)
+4
lib/literal/types/deferred_type.rb
··· 13 13 "_Deferred" 14 14 end 15 15 16 + def materialize 17 + @block.call 18 + end 19 + 16 20 def ===(other) 17 21 @block.call === other 18 22 end