class UUIDGen::UUID

Attributes

decimal[R]

Public Instance Methods

eql?(other) click to toggle source
# File lib/uuidgen/uuid.rb, line 20
def eql?(other)
  @decimal == other.decimal
end
hash() click to toggle source
# File lib/uuidgen/uuid.rb, line 24
def hash
  @decimal.hash
end
to_hex() click to toggle source
# File lib/uuidgen/uuid.rb, line 5
def to_hex
  @decimal.to_s(16).rjust(32, '0')
end
to_s() click to toggle source
# File lib/uuidgen/uuid.rb, line 9
def to_s
  hex_string = to_hex
  '%s-%s-%s-%s-%s' % [
    hex_string[0, 8],
    hex_string[8, 4],
    hex_string[12, 4],
    hex_string[16, 4],
    hex_string[20, 12]
  ]
end

Protected Instance Methods

set_reserved(decimal) click to toggle source
# File lib/uuidgen/uuid.rb, line 33
def set_reserved(decimal)
  decimal & ~(0xc000 << 48) | 0x8000 << 48
end
set_version(decimal) click to toggle source
# File lib/uuidgen/uuid.rb, line 29
def set_version(decimal)
  decimal & ~(0xf000 << 64) | version << 76
end
version() click to toggle source
# File lib/uuidgen/uuid.rb, line 37
def version
  raise NotImplementedError
end