Class: Identifier::Global::Uuid

Inherits:
Identifier::Global show all
Defined in:
app/models/identifier/global/uuid.rb

Overview

Universally Unique Identifier

validates :identifier, :format => => /[0-9a-f]{8-[0-9a-f]4-[0-9a-f]4-[0-9a-f]4-[0-9a-f]12/i, :message => 'Invalid UUID.'}

Constant Summary

Constant Summary

Constants inherited from Identifier

SHORT_NAMES

Instance Attribute Summary

Attributes inherited from Identifier::Global

#relation

Attributes inherited from Identifier

#cached, #identifier, #identifier_object_id, #namespace_id, #project_id, #type

Instance Method Summary (collapse)

Methods inherited from Identifier::Global

#permit_only_one_global_without_relation_supplied_per_type, #set_cached

Methods inherited from Identifier

#annotated_object, class_name, find_for_autocomplete, generate_download, #klass_name, prototype_identifier, #set_cached

Methods included from Housekeeping

#has_polymorphic_relationship?

Instance Method Details

- (Object) using_uuid_class



8
9
10
11
12
13
14
15
# File 'app/models/identifier/global/uuid.rb', line 8

def using_uuid_class
  unless identifier.nil?
    /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i =~ identifier
    if $&.nil?
      errors.add(:identifier, "#{identifier} is not a valid UUID.")
    end
  end
end