DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Generate A UUID With UUIDTools In Ruby1.9.1

03.17.2010
| 3268 views |
  • submit to reddit
        Source: <a href="http://snippets.dzone.com/posts/show/8403">Generate a UUID with UUIDTools</a> [dzone.com]

<pre>
sudo gem1.9.1 install uuidtools

Successfully installed uuidtools-2.1.1
1 gem installed
</pre>

require 'uuidtools'
#=> true
UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, "www.widgets.com")
#=> #<UUID:0x5262112 UUID:3d813cbb-47fb-32ba-91df-831e1593ac29>