Class: CassandraObject::Types::JsonType

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

Defined Under Namespace

Classes: DirtyHash

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



42
43
44
# File 'lib/cassandra_object/types/json_type.rb', line 42

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

#encode(hash) ⇒ Object



38
39
40
# File 'lib/cassandra_object/types/json_type.rb', line 38

def encode(hash)
  ActiveSupport::JSON.encode(hash)
end

#wrap(record, name, value) ⇒ Object



46
47
48
# File 'lib/cassandra_object/types/json_type.rb', line 46

def wrap(record, name, value)
  DirtyHash.new(record, name, Hash(value), options)
end