Method: UUID.parse

Defined in:
lib/cast_off/compile/namespace/uuid.rb

.parse(obj) ⇒ Object

A simple GUID parser: just ignores unknown characters and convert hexadecimal dump into 16-octet object.



194
195
196
197
198
199
# File 'lib/cast_off/compile/namespace/uuid.rb', line 194

def parse obj
  str = obj.to_s.sub %r/\Aurn:uuid:/, ''
  str.gsub! %r/[^0-9A-Fa-f]/, ''
  raw = [str[0..31]].pack 'H*'
  create raw
end