Module Sequel::Plugins::Serialization::ClassMethods
In: lib/sequel/plugins/serialization.rb

Methods

Attributes

serialization_map  [R]  A map of the serialized columns for this model. Keys are column symbols, values are serialization formats (:marshal, :yaml, or :json).
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

Copy the serialization format and columns to serialize into the subclass.

[Source]

    # File lib/sequel/plugins/serialization.rb, line 42
42:         def inherited(subclass)
43:           super
44:           sm = serialization_map.dup
45:           subclass.instance_eval{@serialization_map = sm}
46:         end

The first value in the serialization map. This is only for backwards compatibility, use serialization_map in new code.

[Source]

    # File lib/sequel/plugins/serialization.rb, line 50
50:         def serialization_format
51:           serialization_map.values.first
52:         end

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

[Source]

    # File lib/sequel/plugins/serialization.rb, line 57
57:         def serialize_attributes(format, *columns)
58:           raise(Error, "Unsupported serialization format (#{format}), should be :marshal, :yaml, or :json") unless [:marshal, :yaml, :json].include?(format)
59:           raise(Error, "No columns given.  The serialization plugin requires you specify which columns to serialize") if columns.empty?
60:           define_serialized_attribute_accessor(format, *columns)
61:         end

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

[Source]

    # File lib/sequel/plugins/serialization.rb, line 65
65:         def serialized_columns
66:           serialization_map.keys
67:         end

[Validate]