Class: RightSupport::Data::UUID::Implementation
- Defined in:
- lib/right_support/data/uuid.rb
Overview
The base class for all UUID implementations. Subclasses must override #initialize such that they raise an exception if the implementation is not available, and #generate such that it returns a String containing a UUID.
Direct Known Subclasses
Class Method Summary collapse
-
.available ⇒ Object
Determine which UUID implementations are available in this Ruby VM.
-
.default ⇒ Object
Determine the default UUID implementation in this Ruby VM.
- .inherited(klass) ⇒ Object
Instance Method Summary collapse
Class Method Details
.available ⇒ Object
Determine which UUID implementations are available in this Ruby VM.
Return
- available(Array)
-
the available implementation classes
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/right_support/data/uuid.rb', line 45 def self.available avail = [] @subclasses.each do |eng| begin eng.new #if it initializes, it's available! avail << eng rescue Exception => e #must not be available! end end avail end |
.default ⇒ Object
Determine the default UUID implementation in this Ruby VM.
Return
- available(Array)
-
the available implementation classes
64 65 66 67 |
# File 'lib/right_support/data/uuid.rb', line 64 def self.default #completely arbitrary available.first end |
.inherited(klass) ⇒ Object
37 38 39 |
# File 'lib/right_support/data/uuid.rb', line 37 def self.inherited(klass) @subclasses << klass end |
Instance Method Details
#generate ⇒ Object
69 70 71 |
# File 'lib/right_support/data/uuid.rb', line 69 def generate raise Unavailable, "This implementation is currently not available" end |