Sha256: 3a8c90680495100120b3baf59b832f445e9c247cea50b1e436a18a3a1182947f

Contents?: true

Size: 610 Bytes

Versions: 117

Compression:

Stored size: 610 Bytes

Contents

module CassandraObject
  module Types
    module UTF8StringType
      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
      module_function :encode

      def decode(str)
        str.force_encoding('UTF-8')
      end
      module_function :decode
    end
  end
end

Version data entries

117 entries across 117 versions & 2 rubygems

Version Path
sessionm-cassandra_object-4.0.13 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.12 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.11 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.10 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.9 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-2.7.3 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-2.7.2 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.8 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.7 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.6 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.5 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.4 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.3 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.2 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.1 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-4.0.0 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-2.7.1 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-2.7.0 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-2.6.1 lib/cassandra_object/types/utf8_string_type.rb
sessionm-cassandra_object-2.6.0 lib/cassandra_object/types/utf8_string_type.rb