module Sequel::Plugins::SerializationModificationDetection::InstanceMethods

  1. lib/sequel/plugins/serialization_modification_detection.rb

Methods

Public Instance

  1. after_save
  2. changed_columns
  3. freeze

Public Instance methods

after_save ()

Clear the cache of original deserialized values after saving so that it doesn't show the column is modified after saving.

[show source]
# File lib/sequel/plugins/serialization_modification_detection.rb, line 36
def after_save
  super
  @original_deserialized_values = @deserialized_values
end
changed_columns ()

Detect which serialized columns have changed.

[show source]
# File lib/sequel/plugins/serialization_modification_detection.rb, line 42
def changed_columns
  cc = super
  cc = cc.dup if frozen?
  deserialized_values.each{|c, v| cc << c if !cc.include?(c) && original_deserialized_value(c) != v} 
  cc
end
freeze ()

Freeze the original deserialized values when freezing the instance.

[show source]
# File lib/sequel/plugins/serialization_modification_detection.rb, line 50
def freeze
  @original_deserialized_values ||= {}
  @original_deserialized_values.freeze
  super
end