Sha256: 55d8d8aa97a48463977a63ad3f1fb13cb8e49f88ed003d69d33880752dc12a09

Contents?: true

Size: 352 Bytes

Versions: 21

Compression:

Stored size: 352 Bytes

Contents

module CassandraObject
  module Types
    class ArrayType < BaseType
      def encode(array)
        raise ArgumentError.new("#{array.inspect} is not an Array") unless array.kind_of?(Array)
        array.to_a.to_json
      end

      def decode(str)
        return nil if str.blank?

        ActiveSupport::JSON.decode(str)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
extendi-cassandra_object-1.1.1 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.1.0 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.20 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.19 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.18 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.17 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.16 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.15 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.14 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.13 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.12 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.11 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.10 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.9 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.8 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.7 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.6 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.5 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.4 lib/cassandra_object/types/array_type.rb
extendi-cassandra_object-1.0.1 lib/cassandra_object/types/array_type.rb