30 #import <ActiveSupportKit/ActiveSupportKit.h>
34 - (NSDictionary *)propertiesFromResource:(
ARResource *)resource
36 NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
37 for (NSPropertyDescription *property in [
self properties])
39 if ([property isKindOfClass:[NSAttributeDescription
class]])
43 NSAttributeDescription *attribute = (NSAttributeDescription *)property;
44 id value = [attribute valueInResource:resource];
45 [attributes setObject:value ? value : [NSNull null] forKey:[attribute name]];
48 return [attributes copy];
51 - (NSDictionary *)attributesFromObject:(NSObject *)object
53 NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
54 for (NSPropertyDescription *property in [
self properties])
56 if ([property isKindOfClass:[NSAttributeDescription
class]])
58 NSAttributeDescription *attribute = (NSAttributeDescription *)property;
59 id value = [attribute valueInObject:object];
60 [attributes setObject:value ? value : [NSNull null] forKey:[[ASInflector defaultInflector] underscore:[attribute name]]];
63 return [attributes copy];