module Kernel
Public Class Methods
UUID(uuid)
click to toggle source
Cast to UUID
@raise [TypeError]
# File lib/uuid.rb, line 5 def UUID(uuid) if uuid.nil? then UUID::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.size == 16 ? UUID.new(uuid) : UUID.parse(uuid) else raise TypeError, "can't convert #{uuid.class} into UUID" end end
Private Instance Methods
UUID(uuid)
click to toggle source
Cast to UUID
@raise [TypeError]
# File lib/uuid.rb, line 5 def UUID(uuid) if uuid.nil? then UUID::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.size == 16 ? UUID.new(uuid) : UUID.parse(uuid) else raise TypeError, "can't convert #{uuid.class} into UUID" end end