From 701267af230af9d5bbe5427438f1482a66ea6448 Mon Sep 17 00:00:00 2001 From: Aaron Stone Date: Tue, 8 Oct 2013 14:11:05 -0700 Subject: [PATCH] UUIDTools::UUID.is_uuid? returns true if the string value has the general format of a UUID. Does not validate the UUID at all. --- lib/uuidtools.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/uuidtools.rb b/lib/uuidtools.rb index 38ed27c..801552e 100644 --- a/lib/uuidtools.rb +++ b/lib/uuidtools.rb @@ -519,6 +519,13 @@ def generate_raw def eql?(other) return self == other end + + ## + # Returns true if the string value has the general format of a UUID. + # Does not validate the UUID at all. + def self.is_uuid?(str) + !!(str =~ UUIDTools::UUID_REGEXP) + end # # Determine what OS we're running on. Helps decide how to find the MAC