module Sniffed::Sniffer::SniffedInstanceMethods

Public Instance Methods

commited_changes() click to toggle source
# File lib/sniffed/sniffer.rb, line 21
def commited_changes
  @unfiltered_commited_changes.reject(&unchanged_attributes)
end
reset_commited_changes() click to toggle source
# File lib/sniffed/sniffer.rb, line 17
def reset_commited_changes
  @unfiltered_commited_changes = {}
end

Private Instance Methods

testing() click to toggle source
# File lib/sniffed/sniffer.rb, line 32
def testing
end
track_commited_change() click to toggle source
# File lib/sniffed/sniffer.rb, line 35
def track_commited_change
  lambda do |(attribute, (previous_value, current_value))|
    if @unfiltered_commited_changes.key?(attribute)
      @unfiltered_commited_changes[attribute][1] = current_value
    else
      @unfiltered_commited_changes[attribute] = [previous_value, current_value]
    end
  end
end
track_commited_changes() click to toggle source
# File lib/sniffed/sniffer.rb, line 27
def track_commited_changes
  previous_changes.each_pair(&testing)
  previous_changes.each_pair(&track_commited_change)
end
unchanged_attributes() click to toggle source
# File lib/sniffed/sniffer.rb, line 45
def unchanged_attributes
  lambda do |_k, (previous_value, current_value)|
    previous_value == current_value
  end
end