Class: UUIDGen::NameSpace

Inherits:
UUID
  • Object
show all
Defined in:
lib/uuidgen/name_space.rb

Instance Attribute Summary

Attributes inherited from UUID

#decimal

Instance Method Summary collapse

Methods inherited from UUID

#eql?, #hash, #to_hex, #to_s

Constructor Details

#initialize(target) ⇒ NameSpace

Returns a new instance of NameSpace.



3
4
5
# File 'lib/uuidgen/name_space.rb', line 3

def initialize(target)
  @decimal = target.gsub('-', '').hex
end

Instance Method Details

#to_hexa_stringObject



7
8
9
10
11
# File 'lib/uuidgen/name_space.rb', line 7

def to_hexa_string
  to_hex.chars.each_slice(2).map do |first, second|
    (first + second).hex.chr
  end.join
end