Module: Vidibus::Uuid

Defined in:
lib/vidibus/uuid.rb,
lib/vidibus/uuid/mongoid.rb,
lib/vidibus/uuid/version.rb,
lib/vidibus/uuid/validator.rb,
lib/vidibus-uuid.rb

Defined Under Namespace

Modules: Mongoid, Validator Classes: Engine

Constant Summary collapse

VERSION =
'1.0.0'

Class Method Summary collapse

Class Method Details

.generateObject

Returns a new compact UUID.



5
6
7
# File 'lib/vidibus/uuid.rb', line 5

def self.generate
  UUID.new.generate(:compact)
end

.validate(uuid) ⇒ Object

Returns true if given UUID is valid.



10
11
12
13
# File 'lib/vidibus/uuid.rb', line 10

def self.validate(uuid)
  uuid = uuid.to_s
  UUID.validate(uuid) && uuid.length == 32
end