1
2
3
4
5
6
7
class String
  def to_uuid_format
    s = self.gsub(/[^a-fA-F0-9]/, '')
    s = s + ("0" * (32 - s.length))
    "#{s[0..7]}-#{s[8..11]}-#{s[12..15]}-#{s[16..19]}-#{s[20..31]}"
  end
end