Module: Sequel::Plugins::SerializationModificationDetection::InstanceMethods
- Defined in:
- lib/sequel/plugins/serialization_modification_detection.rb
Instance Method Summary collapse
-
#after_save ⇒ Object
Clear the cache of original deserialized values after saving so that it doesn’t show the column is modified after saving.
-
#changed_columns ⇒ Object
Detect which serialized columns have changed.
-
#freeze ⇒ Object
Freeze the original deserialized values when freezing the instance.
Instance Method Details
#after_save ⇒ Object
Clear the cache of original deserialized values after saving so that it doesn’t show the column is modified after saving.
35 36 37 38 |
# File 'lib/sequel/plugins/serialization_modification_detection.rb', line 35 def after_save super @original_deserialized_values = @deserialized_values end |
#changed_columns ⇒ Object
Detect which serialized columns have changed.
41 42 43 44 45 46 |
# File 'lib/sequel/plugins/serialization_modification_detection.rb', line 41 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 ⇒ Object
Freeze the original deserialized values when freezing the instance.
49 50 51 52 53 |
# File 'lib/sequel/plugins/serialization_modification_detection.rb', line 49 def freeze @original_deserialized_values ||= {} @original_deserialized_values.freeze super end |