module Mongoid::Uuid

Constants

VERSION

Public Class Methods

validate(uuid) click to toggle source
# File lib/mongoid/uuid.rb, line 12
def self.validate(uuid)
  uuid.class.to_s == 'BSON::Binary' and
    uuid.type == :uuid and
    validate_format(uuid.data)
end
validate_format(uuid) click to toggle source

github.com/assaf/uuid/blob/27ae70845ff9f3be71060f473565aa7d1e6ed781/lib/uuid.rb#L199

# File lib/mongoid/uuid.rb, line 19
def self.validate_format(uuid)
  return true if uuid =~ /\A(urn:uuid:)?[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12}\z/i
end