Class: Quandl::Cassandra::Types::UTF8Type

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

Instance Attribute Summary

Attributes inherited from AbstractType

#value

Class Method Summary collapse

Methods inherited from AbstractType

#initialize, quote_string, #sanitize, #sanitize_for_cql

Constructor Details

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

Class Method Details

.sanitize(value) ⇒ Object



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

def self.sanitize(value)
  RUBY_VERSION >= "1.9" ? value.to_s.dup.force_encoding('UTF-8') : value.to_s.dup
rescue => e
  raise Quandl::Cassandra::Error::CastException.new("Unable to convert to #{name} #{value}", caller)
end

.sanitize_for_cql(value) ⇒ Object



3
4
5
# File 'lib/quandl/cassandra/types/utf8_type.rb', line 3

def self.sanitize_for_cql(value)
  quote_string( sanitize(value) )
end