Module: CassandraObject::Types::UTF8StringType
- Defined in:
- lib/cassandra_object/types/utf8_string_type.rb
Class Method Summary collapse
Class Method Details
.decode(str) ⇒ Object
12 13 14 |
# File 'lib/cassandra_object/types/utf8_string_type.rb', line 12 def decode(str) str.force_encoding('UTF-8') end |
.encode(str) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/cassandra_object/types/utf8_string_type.rb', line 4 def encode(str) # This is technically the most correct, but it is a pain to require utf-8 encoding for all strings. Should revisit. #raise ArgumentError.new("#{self} requires a UTF-8 encoded String") unless str.kind_of?(String) && str.encoding == Encoding::UTF_8 raise ArgumentError.new("#{self} requires a String") unless str.kind_of?(String) str.dup end |