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.
37 38 39 40 |
# File 'lib/sequel/plugins/serialization_modification_detection.rb', line 37 def after_save super @original_deserialized_values = @deserialized_values end |
#changed_columns ⇒ Object
Detect which serialized columns have changed.
43 44 45 46 47 48 |
# File 'lib/sequel/plugins/serialization_modification_detection.rb', line 43 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.
51 52 53 54 55 56 |
# File 'lib/sequel/plugins/serialization_modification_detection.rb', line 51 def freeze @original_deserialized_values ||= {} super @original_deserialized_values.freeze self end |