Module | Sequel::Plugins::ModificationDetection::InstanceMethods |
In: |
lib/sequel/plugins/modification_detection.rb
|
Recalculate the column value hashes after updating.
# File lib/sequel/plugins/modification_detection.rb, line 43 43: def after_update 44: super 45: recalculate_values_hashes 46: end
Calculate the column hash values if they haven‘t been already calculated.
# File lib/sequel/plugins/modification_detection.rb, line 49 49: def calculate_values_hashes 50: @values_hashes || recalculate_values_hashes 51: end
Detect which columns have been modified by comparing the cached hash value to the hash of the current value.
# File lib/sequel/plugins/modification_detection.rb, line 55 55: def changed_columns 56: cc = super 57: changed = [] 58: v = @values 59: if vh = @values_hashes 60: (vh.keys - cc).each{|c| changed << c unless v.has_key?(c) && vh[c] == v[c].hash} 61: end 62: cc + changed 63: end