def check_values(key_prefix, error_key, match_function, expected_instance = expected)
      expected_value = ExpectedValue.new(match_function, expected_instance, error_key, @prefix)
      target_value = TargetValue.new([key_prefix, error_key].compact.join('.'), target)
      add_error(expected_value, target_value) unless expected_value == target_value
    end
def check_values(key_prefix, error_key, match_function, expected_instance = expected)
      expected_value = ExpectedValue.new(match_function, expected_instance, error_key, @prefix)
      target_value = TargetValue.new([key_prefix, error_key].compact.join('.'), target)
      add_error(expected_value, target_value) unless expected_value == target_value
    end
Checks fields on a single instance
 @api private
 @param key_prefix [String] optional parent key if iterating through nested association
 @param error_key [String] the name of the field reported in the error
 @param match_function [Hash]
   a function returning the value for the key for the object being serialized
 @param expected_instance [Object]
   the top level instance, or an each instance from #check_each
 the index if iterating through a list, otherwise nil
 @return [nil] returns nothing, adds to error list as side effect