Class: UuidAttribute::UUID

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

Overview

UUID Attribute

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ UUID

Returns a new instance of UUID.



5
6
7
8
# File 'lib/uuid_attribute/uuid.rb', line 5

def initialize(value)
  @hex = Utils.normalize(Utils.parse(value))
  @shorten = Utils.shorten(@hex)
end

Instance Method Details

#hexObject



14
15
16
# File 'lib/uuid_attribute/uuid.rb', line 14

def hex
  @hex
end

#rawObject



18
19
20
# File 'lib/uuid_attribute/uuid.rb', line 18

def raw
  UuidAttribute::Utils.raw_bytes(@hex)
end

#to_sObject



10
11
12
# File 'lib/uuid_attribute/uuid.rb', line 10

def to_s
  @shorten
end