Class: WAB::UUID
- Inherits:
-
Object
- Object
- WAB::UUID
- 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
-
#id ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(id) ⇒ UUID
constructor
Initializes a UUID from string representation of the UUID following the pattern “123e4567-e89b-12d3-a456-426655440000”.
Constructor Details
#initialize(id) ⇒ UUID
Initializes a UUID from string representation of the UUID following the pattern “123e4567-e89b-12d3-a456-426655440000”.
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
#id ⇒ Object (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 |