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
37 def after_save
38   super
39   @original_deserialized_values = @deserialized_values
40 end
changed_columns()

Detect which serialized columns have changed.

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

Freeze the original deserialized values when freezing the instance.

[show source]
   # File lib/sequel/plugins/serialization_modification_detection.rb
51 def freeze
52   @original_deserialized_values ||= {}
53   super
54   @original_deserialized_values.freeze
55   self
56 end