Class: CassandraCQL::Types::UTF8Type

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

Class Method Summary collapse

Class Method Details

.cast(value) ⇒ Object



20
21
22
23
24
# File 'lib/cassandra-cql/types/utf8_type.rb', line 20

def self.cast(value)
  RUBY_VERSION >= "1.9" ? value.to_s.dup.force_encoding('UTF-8') : value.to_s.dup
rescue => e
  raise CassandraCQL::Error::CastException, "Unable to convert bytes to UTF8: #{bytes.inspect}", caller
end