Class: WAB::UUID

Inherits:
Object
  • Object
show all
Defined in:
lib/wab/uuid.rb

Overview

The UUID class representing a 128 bit UUID although values are not validated for conformane to the ISO/IEC specifications.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ UUID

Initializes a UUID from string representation of the UUID following the pattern “123e4567-e89b-12d3-a456-426655440000”.

Raises:



12
13
14
15
# File 'lib/wab/uuid.rb', line 12

def initialize(id)
  @id = id.downcase
  raise WAB::ParseError.new('Invalid UUID format.') unless WAB::Utils.uuid_format?(@id)
end

Instance Attribute Details

#idObject (readonly) Also known as: to_s

Returns the value of attribute id.



8
9
10
# File 'lib/wab/uuid.rb', line 8

def id
  @id
end

Instance Method Details

#==(other) ⇒ Object



20
21
22
# File 'lib/wab/uuid.rb', line 20

def ==(other)
  other.is_a?(self.class) && @id == other.id
end