0.01
No commit activity in last 3 years
No release in over 3 years
UUIDs that are byte-ordered lamport clocks (timestamp, worker_id). Much simpler than type-1 UUID's crappy, weirdo layout.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.2.9

Runtime

>= 0
 Project Readme

lexical_uuid¶ ↑

UUIDs that are byte-ordered lamport clocks (timestamp, worker_id). Much simpler than type-1 UUID’s crappy, weirdo layout.

Disclaimer¶ ↑

This won’t work on 32bit platforms. Fuck 32bit platforms.

Install¶ ↑

sudo gem install lexical_uuid

Usage¶ ↑

ree-1.8.7-2010.02 > LexicalUUID.new
=> #<LexicalUUID:0x1019400f0 @worker_id=2842420286492008582, @timestamp=1281991807929511>

r ee-1.8.7-2010.02 > LexicalUUID.new.to_guid

=> "00048df6-faef-2bb5-2772-4e30d6b86086"

r ee-1.8.7-2010.02 > LexicalUUID.new.to_bytes

=> "\000\004\215\366\373\"\022\352'rN0\326\270206"

r ee-1.8.7-2010.02 > LexicalUUID.new(LexicalUUID.new.to_guid)

=> #<LexicalUUID:0x101936118 @worker_id=2842420286492008582, @timestamp=1281991837642798>

r ee-1.8.7-2010.02 > LexicalUUID.new(LexicalUUID.new.to_bytes)

=> #<LexicalUUID:0x101931690 @worker_id=2842420286492008582, @timestamp=1281991842330188>

r ee-1.8.7-2010.02 > LexicalUUID.new(Time.now)

=> #<LexicalUUID:0x10192df18 @worker_id=2842420286492008582, @timestamp=1281991847641387>

Credits¶ ↑

  • The idea was basically stolen from Coda Hale (@coda).

  • I borrowed some code from simple_uuid by @evan, @rk, etc.

Copyright © 2010 James Golick. See LICENSE for details.