Module: Sequel::Plugins::Serialization::InstanceMethods

Defined in:
lib/sequel/plugins/serialization.rb

Instance Method Summary collapse

Instance Method Details

#before_validationObject

Serialize deserialized values before saving



191
192
193
194
# File 'lib/sequel/plugins/serialization.rb', line 191

def before_validation
  serialize_deserialized_values
  super
end

#deserialized_valuesObject

Hash of deserialized values, used as a cache.



178
179
180
# File 'lib/sequel/plugins/serialization.rb', line 178

def deserialized_values
  @deserialized_values ||= {}
end

#freezeObject

Freeze the deserialized values



183
184
185
186
187
188
# File 'lib/sequel/plugins/serialization.rb', line 183

def freeze
  deserialized_values
  super
  deserialized_values.freeze
  self
end