Add support and test coverage for serializing Boolean properties to JSON as true/false instead of numbers. closes #920, #827

This commit is contained in:
Blake Watters
2012-11-08 23:41:19 -05:00
parent b723788fce
commit e109036683
11 changed files with 231 additions and 67 deletions

View File

@@ -25,8 +25,6 @@
#import "RKObjectUtilities.h"
#import "RKMacros.h"
RK_FIX_CATEGORY_BUG(RKPropertyInspector_CoreData)
// Set Logging Component
#undef RKLogComponent
#define RKLogComponent RKlcl_cRestKitCoreData
@@ -89,3 +87,24 @@ RK_FIX_CATEGORY_BUG(RKPropertyInspector_CoreData)
}
@end
@interface NSManagedObject (RKPropertyInspection)
- (Class)rk_classForPropertyAtKeyPath:(NSString *)keyPath;
@end
@implementation NSManagedObject (RKPropertyInspection)
- (Class)rk_classForPropertyAtKeyPath:(NSString *)keyPath
{
NSArray *components = [keyPath componentsSeparatedByString:@"."];
Class propertyClass = [self class];
for (NSString *property in components) {
propertyClass = [[RKPropertyInspector sharedInspector] classForPropertyNamed:property ofEntity:[self entity]];
propertyClass = propertyClass ?: [[RKPropertyInspector sharedInspector] classForPropertyNamed:property ofClass:propertyClass];
if (! propertyClass) break;
}
return propertyClass;
}
@end