Ruby version 3? #2
Replies: 2 comments 3 replies
-
Try v0.1.1? |
Beta Was this translation helpful? Give feedback.
-
This is probably unrelated to Ruby, and might be purely cosmetic, so I can put this in a new discussion if necessary or just ignore it because it is working as intended. I wrote a small script to see how the length of sqids change compared to hash ids. Ideally we'd like to pick a minimum length that will stay relatively consistent and only grow longer late into the product lifecycle. However, while sqids definitely produce more random batches of characters, the length of the sqids swings back and forth. Here is sample code and output to demonstrate: Sample Output
Codedef test
sqid_encoder = Sqids.new
hashid_encoder = Hashids.new
sqid_size = 0
hashid_size = 0
i = 0
1_000_0000.times do |i|
new_sqid = sqid_encoder.encode([i])
new_hashid = hashid_encoder.encode([i])
if new_sqid.size != sqid_size || new_hashid.size != hashid_size
puts "%8d : %12s / %12s" % [i, new_sqid, new_hashid]
sqid_size = new_sqid.size if new_sqid.size != sqid_size
hashid_size = new_hashid.size if new_hashid.size != hashid_size
end
end
end |
Beta Was this translation helpful? Give feedback.
-
Any chance of support for Ruby 3.0? Unfortunately, we can't use ruby 3.1 just yet.
Beta Was this translation helpful? Give feedback.
All reactions