module Sequel::Plugins::Serialization::ClassMethods

  1. lib/sequel/plugins/serialization.rb
Parent: Serialization

Attributes

deserialization_map [R]

A hash with column name symbols and callable values, with the value called to deserialize the column.

serialization_map [R]

A hash with column name symbols and callable values, with the value called to serialize the column.

serialization_module [RW]

Module to store the serialized column accessor methods, so they can call be overridden and call super to get the serialization behavior

Public Instance methods

serialize_attributes (format, *columns)

Create instance level reader that deserializes column values on request, and instance level writer that stores new deserialized values.

[show source]
# File lib/sequel/plugins/serialization.rb, line 129
def serialize_attributes(format, *columns)
  if format.is_a?(Symbol)
    unless format = REGISTERED_FORMATS[format]
      raise(Error, "Unsupported serialization format: #{format} (valid formats: #{REGISTERED_FORMATS.keys.map{|k| k.inspect}.join})")
    end
  end
  serializer, deserializer = format
  raise(Error, "No columns given.  The serialization plugin requires you specify which columns to serialize") if columns.empty?
  define_serialized_attribute_accessor(serializer, deserializer, *columns)
end
serialized_columns ()

The columns that will be serialized. This is only for backwards compatibility, use #serialization_map in new code.

[show source]
# File lib/sequel/plugins/serialization.rb, line 142
def serialized_columns
  serialization_map.keys
end