ReversibleId
now no longer downcases the encodedid input string by default on decode, ie thedecode
optiondowncase
is nowfalse
. In a future release thedowncase
option will be removed. Generation of the encoded ID is 1.5 times faster and uses less memory.
encoded_id
now uses its own implementation ofhashids
which is more efficient and has a smaller memory footprint. This massively reduces the GC churn in high-throughput applications. This is an implementation based on the originalhashids
gem but with many optimisations and improvements. Functionally it is identical to the originalhashids
gem.
- Add an optional
max_inputs_per_id
argument toReversibleId
, thanks to @avcwisesa - The option
split_with:
can also now be set to nil to disable splitting of the encoded ID string
- Add an optional
max_length
argument toReversibleId
, thanks to @jugglebird - Alphabet validations to prevent whitespace and null chars
- Add
Alphabet#to_a
,Alphabet#to_s
,Alphabet#size
and a customAlphabet#inspect
- Fixes to input validations
- hashids are case-sensitive, as are
Alphabet
s, howeverReversibleId
was alwaysdowncase
ing the encodedid input string on decode. A new option has been added todecode
anddecode_hex
,downcase
, which defaults totrue
. Thus, the default behaviour is unchanged, but you can opt out to allow mixed case encodedid decode. Note: In V2 this will default tofalse
.
Alphabet
now has#include?
and#unique_charaters
methods
- Improved RBS definitions
- Improved test coverage
- Support custom 'split' character which must not be in the alphabet
- Ability to provide a custom character equivalence mapping
- Fix splitting of encoded ID string
- Checks that integer values to be encoded are positive
- Experimental support for encoding hex strings
- Initial release