Class UUID
In: lib/uuidtools/version.rb
lib/uuidtools.rb
Parent: Object

uuidtools.rb

 UUIDTools was designed to be a simple library for generating any
 of the various types of UUIDs.  It conforms to RFC 4122 whenever
 possible.

Example

  UUID.md5_create(UUID_DNS_NAMESPACE, "www.widgets.com")
  => #<UUID:0x287576 UUID:3d813cbb-47fb-32ba-91df-831e1593ac29>
  UUID.sha1_create(UUID_DNS_NAMESPACE, "www.widgets.com")
  => #<UUID:0x2a0116 UUID:21f7f8de-8051-5b89-8680-0195ef798b6a>
  UUID.timestamp_create
  => #<UUID:0x2adfdc UUID:64a5189c-25b3-11da-a97b-00c04fd430c8>
  UUID.random_create
  => #<UUID:0x19013a UUID:984265dc-4200-4f02-ae70-fe4f48964159>

Methods

Attributes

clock_seq_hi_and_reserved  [RW] 
clock_seq_low  [RW] 
nodes  [RW] 
time_hi_and_version  [RW] 
time_low  [RW] 
time_mid  [RW] 

Public Class methods

Allows users to set the MAC address manually in cases where the MAC address cannot be obtained programatically.

Creates a UUID using the MD5 hash. (Version 3)

Parses a UUID from a string.

Parses a UUID from a raw byte string.

Creates a UUID from a random value.

Creates a UUID using the SHA1 hash. (Version 5)

Public Instance methods

Compares two UUIDs lexically

Returns true if this UUID is exactly equal to the other UUID.

get_mac_address()

Alias for mac_address

Returns an integer hash value.

Returns the hex digest of the UUID object.

Returns a representation of the object‘s state

Returns the IEEE 802 address used to generate this UUID or nil if a MAC address was not used.

Returns true if this UUID is the nil UUID (00000000-0000-0000-0000-000000000000).

This method applies only to version 1 UUIDs. Checks if the node ID was generated from a random number or from an IEEE 802 address (MAC address). Always returns false for UUIDs that aren‘t version 1. This should not be confused with version 4 UUIDs where more than just the node id is random.

Returns the raw bytes that represent this UUID.

Returns the timestamp used to generate this UUID

Returns an integer representation for this UUID.

Returns a string representation for this UUID.

Returns a URI string for this UUID.

Returns true if this UUID is valid.

Returns the UUID variant. Possible values: 0b000 - Reserved, NCS backward compatibility. 0b100 - The variant specified in this document. 0b110 - Reserved, Microsoft Corporation backward compatibility. 0b111 - Reserved for future definition.

Returns the UUID version type. Possible values: 1 - Time-based with unique or random host identifier 2 - DCE Security version (with POSIX UIDs) 3 - Name-based (MD5 hash) 4 - Random 5 - Name-based (SHA-1 hash)

[Validate]