| Class | JSON::Util::UUID |
| In: |
lib/json-schema/uri/uuid.rb
|
| Parent: | Object |
| STATE_FILE | = | 'ruby-uuid' | ||
| NameSpace_DNS | = | parse "6ba7b810-9dad-11d1-80b4-00c04fd430c8" | Pre-defined UUID Namespaces described in RFC4122 Appendix C. | |
| NameSpace_URL | = | parse "6ba7b811-9dad-11d1-80b4-00c04fd430c8" | ||
| NameSpace_OID | = | parse "6ba7b812-9dad-11d1-80b4-00c04fd430c8" | ||
| NameSpace_X500 | = | parse "6ba7b814-9dad-11d1-80b4-00c04fd430c8" | ||
| Nil | = | parse "00000000-0000-0000-0000-000000000000" | The Nil UUID in RFC4122 Section 4.1.7 |
| create_sha1 | -> | create_v5 |
| create_md5 | -> | create_v3 |
| create_random | -> | create_v4 |
| create | -> | create_v1 |
create the "version 1" UUID with current system clock, current UTC timestamp, and the IEEE 802 address (so-called MAC address).
Speed notice: it‘s slow. It writes some data into hard drive on every invokation. If you want to speed this up, try remounting tmpdir with a memory based filesystem (such as tmpfs). STILL slow? then no way but rewrite it with c :)
UUID generation using random-number generator. From it‘s random nature, there‘s no warranty that the created ID is really universaly unique.
UUID generation using SHA1. Recommended over create_md5. Namespace object is another UUID, some of them are pre-defined below.
The ‘primitive constructor’ of this class Note UUID.pack(uuid.unpack) == uuid
A simple GUID parser: just ignores unknown characters and convert hexadecimal dump into 16-octet object.