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

Methods

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

Copy the serialization_map and deserialization map into the subclass.

[Source]

     # File lib/sequel/plugins/serialization.rb, line 103
103:         def inherited(subclass)
104:           super
105:           sm = serialization_map.dup
106:           dsm = deserialization_map.dup
107:           subclass.instance_eval do
108:             @deserialization_map = dsm
109:             @serialization_map = sm
110:           end
111:         end

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

[Source]

     # File lib/sequel/plugins/serialization.rb, line 115
115:         def serialize_attributes(format, *columns)
116:           if format.is_a?(Symbol)
117:             unless format = REGISTERED_FORMATS[format]
118:               raise(Error, "Unsupported serialization format: #{format} (valid formats: #{REGISTERED_FORMATS.keys.map{|k| k.inspect}.join})")
119:             end
120:           end
121:           serializer, deserializer = format
122:           raise(Error, "No columns given.  The serialization plugin requires you specify which columns to serialize") if columns.empty?
123:           define_serialized_attribute_accessor(serializer, deserializer, *columns)
124:         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 128
128:         def serialized_columns
129:           serialization_map.keys
130:         end

[Validate]