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.
41 42 43 44 |
# File 'lib/sequel/plugins/serialization_modification_detection.rb', line 41 def after_save super @original_deserialized_values = @deserialized_values end |
#changed_columns ⇒ Object
Detect which serialized columns have changed.
47 48 49 50 51 52 |
# File 'lib/sequel/plugins/serialization_modification_detection.rb', line 47 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.
55 56 57 58 59 60 |
# File 'lib/sequel/plugins/serialization_modification_detection.rb', line 55 def freeze @original_deserialized_values ||= {} super @original_deserialized_values.freeze self end |