Simple, scalable UUID generation.
Copyright 2009-2010 Twitter, Inc. See included LICENSE file.
-
pure-Ruby
-
no MAC address scraping
-
no file-based locking
This library implements UUID format version 1, as specified in RFC 4122, with jitter in place of the mac address and sequence counter.
Install the gem:
sudo gem install simple_uuid
# Creating and getting a timestamp from the UUID uuid = SimpleUUID::UUID.new => <UUID#2278170300 .... > uuid.to_time => Thu Aug 18 19:15:16 -0400 2011 # Given raw bytes from a source such as cassandra (using bytes from an existing UUID as an example) bytes = SimpleUUID::UUID.new.bytes SimpleUUID::UUID.to_time(bytes) => Thu Aug 18 19:15:16 -0400 2011
The support forum is here.
Patches and contributions are very welcome.