Module: Kernel

Defined in:
lib/uuid.rb

Class Method Summary collapse

Class Method Details

.UUID(uuid) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/uuid.rb', line 2

def UUID(uuid)
    if    uuid.nil?                       then nil
    elsif uuid.is_a?(UUID)                then uuid
    elsif uuid.is_a?(Integer)             then UUID.new(uuid)
    elsif uuid = String.try_convert(uuid) then UUID.parse(uuid)
    else raise ArgumentError, 
             "bad argument (expected UUID object, string or integer)"
    end
end