diff --git a/src/cbor/serializable.cr b/src/cbor/serializable.cr index 77d0689..b1fe894 100644 --- a/src/cbor/serializable.cr +++ b/src/cbor/serializable.cr @@ -244,6 +244,10 @@ module CBOR raise ::CBOR::SerializationError.new("Unknown CBOR attribute: #{key}", self.class.to_s, nil) end + protected def get_cbor_unmapped + {} of String => ::CBOR::Type + end + protected def on_to_cbor(cbor : ::CBOR::Encoder) end @@ -283,6 +287,7 @@ module CBOR {% end %} # macro unless value[:emit_null] {% end %} # macro for properties + nb_properties_to_serialize += get_cbor_unmapped.size {% if properties.size > 0 %} @@ -329,6 +334,10 @@ module CBOR end end + protected def get_cbor_unmapped + cbor_unmapped + end + protected def on_to_cbor(cbor : ::CBOR::Encoder) cbor_unmapped.each do |key, value| cbor.write(key)