Class: CassandraObject::Types::ArrayType
- Defined in:
- lib/cassandra_object/types/array_type.rb
Instance Attribute Summary
Attributes inherited from BaseType
Instance Method Summary collapse
Methods inherited from BaseType
#default, #initialize, #typecast
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
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 |