Class: CassandraObject::Types::ArrayType

Inherits:
BaseType
  • Object
show all
Defined in:
lib/cassandra_object/types/array_type.rb

Instance Attribute Summary

Attributes inherited from BaseType

#options

Instance Method Summary collapse

Methods inherited from BaseType

#default, #initialize

Constructor Details

This class inherits a constructor from CassandraObject::Types::BaseType

Instance Method Details

#decode(str) ⇒ Object



9
10
11
12
13
# File 'lib/cassandra_object/types/array_type.rb', line 9

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

  ActiveSupport::JSON.decode(str)
end

#encode(array) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
7
# File 'lib/cassandra_object/types/array_type.rb', line 4

def encode(array)
  raise ArgumentError.new("#{array.inspect} is not an Array") unless array.kind_of?(Array)
  array.to_a.to_json
end

#wrap(record, name, value) ⇒ Object



15
16
17
# File 'lib/cassandra_object/types/array_type.rb', line 15

def wrap(record, name, value)
  value
end