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

+ (Object) auto_value



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

def self.auto_value
    generate
end

+ (Object) generate



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

- (Object) format(type = :normal)

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

- (Object) map(mapper_type)



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

def map(mapper_type)
    self.to_s
end