ulid / spec

The canonical spec for ulid
GNU General Public License v3.0
9.73k stars 174 forks source link

Add Ruby implementations #58

Closed kachick closed 6 months ago

kachick commented 3 years ago

@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 commented 6 months ago

Thanks for your review!

But this spec repository looks not updated in this 5 years, I close this PR in favor of https://github.com/ietf-wg-uuidrev/rfc4122bis/commit/6fbd9f0666687c58da593370240c4c1b83a63b59 => https://github.com/kachick/ruby-ulid/issues/540 🙇‍♂️