Copy the serialization format and columns to serialize into the subclass.
# File lib/sequel/plugins/serialization.rb, line 56 def inherited(subclass) super sm = serialization_map.dup subclass.instance_eval{@serialization_map = sm} end
The first value in the serialization map. This is only for backwards compatibility, use serialization_map in new code.
# File lib/sequel/plugins/serialization.rb, line 64 def serialization_format serialization_map.values.first end
Create instance level reader that deserializes column values on request, and instance level writer that stores new deserialized value in deserialized columns
# File lib/sequel/plugins/serialization.rb, line 71 def serialize_attributes(format, *columns) raise(Error, "Unsupported serialization format (#{format}), should be :marshal, :yaml, or :json") unless [:marshal, :yaml, :json].include?(format) raise(Error, "No columns given. The serialization plugin requires you specify which columns to serialize") if columns.empty? define_serialized_attribute_accessor(format, *columns) end
The columns that will be serialized. This is only for backwards compatibility, use serialization_map in new code.
# File lib/sequel/plugins/serialization.rb, line 79 def serialized_columns serialization_map.keys end
Generated with the Darkfish Rdoc Generator 2.