Add support for mapping an array to an NSOrderedSet.

This commit is contained in:
Brian Morton
2012-01-13 00:04:40 -08:00
parent 3cf2ea5824
commit 0f3f3d5702

View File

@@ -160,11 +160,20 @@ BOOL RKObjectIsValueEqualToValue(id sourceValue, id destinationValue) {
if ([destinationType isSubclassOfClass:[NSArray class]]) {
return [(NSSet*)value allObjects];
}
} else if ([sourceType isSubclassOfClass:[NSOrderedSet class]]) {
// OrderedSet -> Array
if ([destinationType isSubclassOfClass:[NSArray class]]) {
return [(NSOrderedSet*)value array];
}
} else if ([sourceType isSubclassOfClass:[NSArray class]]) {
// Array -> Set
if ([destinationType isSubclassOfClass:[NSSet class]]) {
return [NSSet setWithArray:value];
}
// Array -> OrderedSet
if ([destinationType isSubclassOfClass:[NSOrderedSet class]]) {
return [NSOrderedSet orderedSetWithArray:value];
}
} else if ([sourceType isSubclassOfClass:[NSNumber class]] && [destinationType isSubclassOfClass:[NSDate class]]) {
// Number -> Date
return [NSDate dateWithTimeIntervalSince1970:[(NSNumber*)value intValue]];