As you moved to the binary format for flags and since the hash is frozen, no further serializers can be added anymore, e.g. Oj
The solution would be to allow user to add custom serializers (e.g. in a rails initializer file), something like
Readthis.add_serializer(Oj)
Since having a frozen hash for serializer is a very good thing once the app is configured I'd also add a method to lock them, like
Readthis.freeze_serializers!
The drawback is that user needs to call that method manually, in Rails code you might introduce a railtie to freeze that hash after app initialization.
Also if you want to have some more slots you can refactor the binary flag to use 4 bytes for serializer I used only 3 bits because no user will use more than 3 or 4 of them, but you still have 4 bits available for whatever you need. Otherwise you can shift the compressed flag to the left side using 0x80 as value for COMPRESSED_FLAG in this way the 4 unused bits will remain in the center part of the byte.
Sorry to bother you with all these requests, but you're building a very good library and I'd like to use it in my projects.
As you moved to the binary format for flags and since the hash is frozen, no further serializers can be added anymore, e.g.
Oj
The solution would be to allow user to add custom serializers (e.g. in a rails initializer file), something like
Since having a frozen hash for serializer is a very good thing once the app is configured I'd also add a method to lock them, like
The drawback is that user needs to call that method manually, in Rails code you might introduce a railtie to freeze that hash after app initialization.
Also if you want to have some more slots you can refactor the binary flag to use 4 bytes for serializer I used only 3 bits because no user will use more than 3 or 4 of them, but you still have 4 bits available for whatever you need. Otherwise you can shift the compressed flag to the left side using
0x80
as value forCOMPRESSED_FLAG
in this way the 4 unused bits will remain in the center part of the byte.Sorry to bother you with all these requests, but you're building a very good library and I'd like to use it in my projects.