Class: Sinicum::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/sinicum/util.rb

Overview

Public: Collection of various utility methods.

Constant Summary collapse

UUID_REGEXP =
/^[abcdef0-9]{8}-[abcdef0-9]{4}-[abcdef0-9]{4}-[abcdef0-9]{4}-[abcdef0-9]{12}$/i

Class Method Summary collapse

Class Method Details

.is_a_uuid?(value) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
# File 'lib/sinicum/util.rb', line 6

def self.is_a_uuid?(value)
  return false if value.nil? || !value.respond_to?('match')
  result = value.match(UUID_REGEXP)
  !!result
end