Module: RDF::Util::UUID
- Defined in:
- lib/rdf/util/uuid.rb
Overview
Utilities for UUID handling.
Class Method Summary collapse
-
.generate(options = {}) ⇒ String
Generates a UUID string.
Class Method Details
.generate(options = {}) ⇒ 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
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rdf/util/uuid.rb', line 22 def self.generate( = {}) begin require 'uuid' ::UUID.generate([:format] || :default) rescue LoadError => e begin require 'uuidtools' ::UUIDTools::UUID.random_create.hexdigest rescue LoadError => e raise LoadError.new("no such file to load -- uuid or uuidtools") end end end |