# File lib/ole/types/base.rb, line 152 def self.parse str vals = str.scan(/[a-f\d]+/i).map(&:hex) if vals.length == 5 # this is pretty ugly vals[3] = ('%04x' % vals[3]).scan(/../).map(&:hex) vals[4] = ('%012x' % vals[4]).scan(/../).map(&:hex) guid = new vals.flatten.pack(PACK) return guid if guid.format.delete('{}') == str.downcase.delete('{}') end raise ArgumentError, 'invalid guid - %p' % str end