17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/active_support/messages/serializer_with_fallback.rb', line 17
def load(dumped)
format = detect_format(dumped)
if format == self.format
_load(dumped)
elsif format && fallback?(format)
payload = { serializer: SERIALIZERS.key(self), fallback: format, serialized: dumped }
ActiveSupport::Notifications.instrument("message_serializer_fallback.active_support", payload) do
payload[:deserialized] = SERIALIZERS[format]._load(dumped)
end
else
raise "Unsupported serialization format"
end
end
|