Method: MixinBot::UUID#unpacked

Defined in:
lib/mixin_bot/uuid.rb

#unpackedObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/mixin_bot/uuid.rb', line 23

def unpacked
  _hex =
    if hex.present?
      hex.gsub('-', '')
    elsif raw.present?
      _hex = raw.unpack1('H*')
    end

  format(
    '%<first>s-%<second>s-%<third>s-%<forth>s-%<fifth>s',
    first: _hex[0..7],
    second: _hex[8..11],
    third: _hex[12..15],
    forth: _hex[16..19],
    fifth: _hex[20..]
  )
end