spec icon indicating copy to clipboard operation
spec copied to clipboard

Add Ruby implementations

Open kachick opened this issue 4 years ago • 0 comments

@alizain

Hi! I hope to be introduced my library and @abachman's prior arts.

Honestly, I don’t have confident when we can say realized binary implementation in ruby-lang.

But it has integer as the substance. And having some method handling octets.

If this is not enough, I’ll omit the checked to binary implementation, Please tell me!

irb(main):001:0> ulid = ULID.generate
=> ULID(2021-05-17 15:18:53.572 UTC: 01F5XEH5C4SFR88MFBX0ZZWJQX)
irb(main):002:0> ulid.to_i
=> 1959988796846786577792848171152329469
irb(main):003:0> ulid.octets
=> [1, 121, 122, 232, 149, 132, 203, 240, 132, 81, 235, 232, 63, 254, 74, 253]
irb(main):004:0> ulid.milliseconds
=> 1621264733572
irb(main):005:0> ulid.entropy
=> 963077149261497129388797
irb(main):006:0> ulid.to_s
=> "01F5XEH5C4SFR88MFBX0ZZWJQX"
irb(main):007:0> ULID.parse('01F5XEH5C4SFR88MFBX0ZZWJQX') == ulid
=> true

kachick avatar May 17 '21 15:05 kachick