Rename RKDictionaryByReverseMergingDictionaryWithDictionary -> RKDictionaryByMergingDictionaryWithDictionary, since a reverse merge would imply that values in the 1st dictionary take priority whereas we want values in the 2nd dict to overwrite values in the 1st. Refs #938.

This commit is contained in:
Jawwad Ahmad
2012-09-18 15:23:25 -04:00
parent 261cafe18a
commit bfbc345ee8
4 changed files with 10 additions and 10 deletions

View File

@@ -8,12 +8,12 @@
#import "RKDictionaryUtilities.h"
NSDictionary * RKDictionaryByReverseMergingDictionaryWithDictionary(NSDictionary *dictionary, NSDictionary *anotherDictionary)
NSDictionary * RKDictionaryByMergingDictionaryWithDictionary(NSDictionary *dictionary, NSDictionary *anotherDictionary)
{
NSMutableDictionary *mergedDictionary = [NSMutableDictionary dictionaryWithDictionary:dictionary];
[anotherDictionary enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
if ([[mergedDictionary objectForKey:key] isKindOfClass:[NSDictionary class]] && [obj isKindOfClass:[NSDictionary class]]) {
NSDictionary *newVal = RKDictionaryByReverseMergingDictionaryWithDictionary([mergedDictionary objectForKey:key], obj);
NSDictionary *newVal = RKDictionaryByMergingDictionaryWithDictionary([mergedDictionary objectForKey:key], obj);
[mergedDictionary setObject:newVal forKey:key];
} else {
[mergedDictionary setObject:obj forKey:key];