Class: EPIC::Generator::UUID

Inherits:
EPIC::Generator show all
Defined in:
src/epic_generator.rb

Overview

A generator that uses UUIDs to guarantee the uniqueness of created Handles.

Constant Summary

Constant Summary

Constants inherited from Resource

Resource::GLOBAL_LOCK_HASH, Resource::GLOBAL_LOCK_MUTEX

Instance Attribute Summary

Attributes inherited from EPIC::Generator

#description, #parameters

Attributes included from Rackful::Resource

#get_etag, #get_last_modified, #path

Instance Method Summary (collapse)

Methods inherited from EPIC::Generator

[], generators, inherited, #to_rackful

Methods inherited from Resource

#lock, lock, #unlock, #xhtml

Methods included from Rackful::Resource

#default_headers, #destroy, #do_METHOD, #empty?, #http_DELETE, #http_GET, #http_HEAD, #http_OPTIONS, #http_PUT, #http_method, #http_methods, included, #requested?, #serializer, #title, #to_rackful, #to_struct

Constructor Details

- (UUID) initialize(*args)

A new instance of UUID



58
59
60
61
62
63
64
65
# File 'src/epic_generator.rb', line 58

def initialize *args
  super( *args )
  @parameters = {
    :prefix => 'Optional: a string of UTF-8 encoded printable unicode characters to put before the UUID.',
    :suffix => 'Optional: a string of UTF-8 encoded printable unicode characters to put after the UUID.'
  }
  @description = 'This generator uses UUIDs to guarantee the uniqueness of created Handles.'
end

Instance Method Details

- (void) generate(request)



67
68
69
70
71
# File 'src/epic_generator.rb', line 67

def generate request
  prefix = request.GET['prefix'] || ''
  suffix = request.GET['suffix'] || ''
  prefix + DB.instance.uuid + suffix
end