Sha256: f3e4019df3c9de28d66ff30f7c7553a9d24c7bbef666d9f86a17e87269b84938

Contents?: true

Size: 515 Bytes

Versions: 8

Compression:

Stored size: 515 Bytes

Contents

require "uuid"

module Spider; module DataTypes

    # RFC 4122 UUID

    class UUID < String
        include DataType
        
        def map(mapper_type)
            self.to_s
        end
        
        # format :short returns just the first part
        def format(type)
            if (type == :short)
                return self.to_s.split('-')[0]
            end
            return super
        end
        
        def self.generate
            ::UUID.new.generate
        end

    end
    
    
end; end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spiderfw-0.5.7 lib/spiderfw/model/datatypes/uuid.rb
spiderfw-0.5.6 lib/spiderfw/model/datatypes/uuid.rb
spiderfw-0.5.5 lib/spiderfw/model/datatypes/uuid.rb
spiderfw-0.5.4 lib/spiderfw/model/datatypes/uuid.rb
spiderfw-0.5.3 lib/spiderfw/model/datatypes/uuid.rb
spiderfw-0.5.2 lib/spiderfw/model/datatypes/uuid.rb
spiderfw-0.5.1 lib/spiderfw/model/datatypes/uuid.rb
spiderfw-0.5 lib/spiderfw/model/datatypes/uuid.rb