sorentwo / readthis

:newspaper: Pooled active support compliant caching with redis
MIT License
506 stars 40 forks source link

take into account only first 3 bits on integer when inverting serializers #45

Closed kagux closed 8 years ago

kagux commented 8 years ago

I noticed the issue after adding Oj serializer and trying to use Marshal. Instead of original object it would return a string. Turns out serializer couldn't be detected. That's because it would do 1 & 4 in rassoc which is 0. Original implementation works for 3 = "11", and 4="100" works for 4 but cuts off everything below. Instead we should extract first 3 bytes (7 = "111") from passed integer regardless of serializers array length. Thanks @epilgrim for helping me out with this one.

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 4e8f9d09ba8c366f24fb37d7b8387ba97c233bf0 on kagux:fix/serializer_decompose into 553d45273d179ece53c723cb9b4a827a0c378d5b on sorentwo:master.

sorentwo commented 8 years ago

Thanks again. Merged locally with 4aaa51a. I'm going to pull in the next PR and do a minor version release.