Class: Quandl::Cassandra::Types::UUIDType

Inherits:
AbstractType show all
Defined in:
lib/quandl/cassandra/types/uuid_type.rb

Direct Known Subclasses

TimeUUIDType

Instance Attribute Summary

Attributes inherited from AbstractType

#value

Class Method Summary collapse

Methods inherited from AbstractType

#initialize, quote_string, #sanitize, #sanitize_for_cql, sanitize_for_cql

Constructor Details

This class inherits a constructor from Quandl::Cassandra::Types::AbstractType

Class Method Details

.regex_validatorObject



13
14
15
# File 'lib/quandl/cassandra/types/uuid_type.rb', line 13

def self.regex_validator
  /^[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}$/
end

.sanitize(value) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/quandl/cassandra/types/uuid_type.rb', line 5

def self.sanitize(value)
  value = value.to_s
  raise Quandl::Cassandra::Error::CastException, "Unable to convert to #{name} #{value}", caller unless value =~ regex_validator
  value
rescue => e
  raise 
end