Class: Spider::DataTypes::UUID

Inherits:
String
  • Object
show all
Includes:
Spider::DataType
Defined in:
lib/spiderfw/model/datatypes/uuid.rb

Overview

RFC 4122 UUID

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Spider::DataType

#attributes, included, #new, #prepare

Class Method Details

.auto_valueObject



27
28
29
# File 'lib/spiderfw/model/datatypes/uuid.rb', line 27

def self.auto_value
    generate
end

.generateObject



23
24
25
# File 'lib/spiderfw/model/datatypes/uuid.rb', line 23

def self.generate
    UUIDTools::UUID.random_create.to_s
end

Instance Method Details

#format(type = :normal) ⇒ Object

format :short returns just the first part



16
17
18
19
20
21
# File 'lib/spiderfw/model/datatypes/uuid.rb', line 16

def format(type = :normal)
    if (type == :short)
        return self.to_s.split('-')[0]
    end
    return super
end

#map(mapper_type) ⇒ Object



11
12
13
# File 'lib/spiderfw/model/datatypes/uuid.rb', line 11

def map(mapper_type)
    self.to_s
end