cartodb/lib/carto/uuidhelper.rb

16 lines
235 B
Ruby
Raw Normal View History

2020-06-15 10:58:47 +08:00
require 'uuidtools'
module Carto
module UUIDHelper
def is_uuid?(text)
!(Regexp.new(%r{\A#{UUIDTools::UUID_REGEXP}\Z}) =~ text).nil?
end
def random_uuid
UUIDTools::UUID.random_create.to_s
end
end
end