Module: RDF::Util::UUID
- Defined in:
- lib/rdf/util/uuid.rb
Overview
Utilities for UUID handling.
Class Method Summary collapse
-
.generate(format: :default) ⇒ String
Generates a UUID string.
Class Method Details
.generate(format: :default) ⇒ String
Generates a UUID string.
This will make use of either the [UUID][] gem or the [UUIDTools][] gem, whichever of the two happens to be available.
[UUID]: rubygems.org/gems/uuid [UUIDTools]: rubygems.org/gems/uuidtools
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rdf/util/uuid.rb', line 21 def self.generate(format: :default) begin require 'uuid' ::UUID.generate(format) rescue LoadError begin require 'uuidtools' ::UUIDTools::UUID.random_create.hexdigest rescue LoadError raise LoadError.new("no such file to load -- uuid or uuidtools") end end end |