Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove custom class compare method. Use isSubclassOfClass instead.

  • Loading branch information...
commit 810c76737ab1f77f28b02cad8b44ce4fdc6924d2 1 parent c823d1a
@pashields authored
View
2  ClassMapper/Categories/NSObject+ClassMapper.m
@@ -113,7 +113,7 @@ + (Class)classFromAttribute:(NSString *)attr withKey:(NSString *)key {
}
+ (Class)classWithAttributeClass:(Class)attrClass andAttrKey:(NSString *)key {
- if ([ClassMapper _descClass:attrClass isKindOf:[NSArray class]]) {
+ if ([attrClass isSubclassOfClass:[NSArray class]]) {
return [[MapperConfig sharedInstance] classFromKey:key];
} else {
return attrClass;
View
2  ClassMapper/ClassMapper.h
@@ -41,6 +41,4 @@
* object to implement the serializable protocol, or be KVC compliant.
*/
+ (id)serialize:(id<Serializable>)obj;
-#pragma mark protected
-+ (BOOL)_descClass:(Class)desc isKindOf:(Class)parent;
@end
View
17 ClassMapper/ClassMapper.m
@@ -49,21 +49,4 @@ about the fast enumeration (you just get keys), so we explicitly
+ (id)serialize:(id<Serializable>)object {
return [object _cm_serialize];
}
-
-#pragma mark helper
-/*
- * This method functions similarly to isKindOfClass, but on class objects.
- */
-+ (BOOL)_descClass:(Class)desc isKindOf:(Class)parent {
- Class current = desc;
- Class last;
- do {
- if (current == parent) {
- return true;
- }
- last = current;
- current = class_getSuperclass(current);
- } while (last != current);
- return FALSE;
-}
@end
View
10 ClassMapperTests/ClassMapperTests.m
@@ -558,16 +558,6 @@ - (void)testSerializeRay {
foo.aBar.aString, fooCopy.aBar.aString);
}
-#pragma mark runtime tests
-- (void)testRuntime {
- STAssertTrue([ClassMapper _descClass:[NSMutableArray class] isKindOf:[NSArray class]],
- @"NSMutableArray is not considered a subclass of NSArray");
- STAssertFalse([ClassMapper _descClass:[NSArray class] isKindOf:[NSMutableArray class]],
- @"NSArray is considered a subclass of NSMutableArray");
- STAssertTrue([ClassMapper _descClass:[NSMutableArray class] isKindOf:[NSObject class]],
- @"NSMutableArray is not considered a subclass of NSObject");
-}
-
#pragma mark key <-> key mapping test
- (void)testKeyNameMapping {
[[MapperConfig sharedInstance] mapPropertyName:@"aString" toOtherName:@"a_string"];
Please sign in to comment.
Something went wrong with that request. Please try again.