Update project for OS X 10.10.
[enjoyable.git] / Classes / NJMapping.m
index 0e67cd3..1b05c42 100644 (file)
     return self;
 }
 
-- (id)initWithSerialization:(NSDictionary *)serialization
-                   mappings:(NSArray *)mappings {
+- (id)initWithSerialization:(NSDictionary *)serialization {
     if ((self = [self initWithName:serialization[@"name"]])) {
         NSDictionary *entries = serialization[@"entries"];
         if ([entries isKindOfClass:NSDictionary.class]) {
             for (id key in entries) {
                 if ([key isKindOfClass:NSString.class]) {
-                    NJOutput *output = [NJOutput outputDeserialize:entries[key]
-                                                      withMappings:mappings];
+                    NJOutput *output = [NJOutput outputWithSerialization:entries[key]];
                     if (output)
                         _entries[key] = output;
                 }
     return NO;
 }
 
-+ (id)mappingWithContentsOfURL:(NSURL *)url mappings:(NSArray *)mappings error:(NSError **)error {
++ (id)mappingWithContentsOfURL:(NSURL *)url error:(NSError **)error {
     NSInputStream *stream = [NSInputStream inputStreamWithURL:url];
     [stream open];
     NSDictionary *serialization = stream && !*error
-        ? [NSJSONSerialization JSONObjectWithStream:stream options:0 error:error]
+        ? [NSJSONSerialization JSONObjectWithStream:stream
+                                            options:(NSJSONReadingOptions)0
+                                              error:error]
         : nil;
     [stream close];
     
         return nil;
     }
     
-    return [[NJMapping alloc] initWithSerialization:serialization
-                                           mappings:mappings];
+    return [[NJMapping alloc] initWithSerialization:serialization];
 }
 
 - (void)mergeEntriesFrom:(NJMapping *)other {
         [_entries addEntriesFromDictionary:other->_entries];
 }
 
+- (void)postLoadProcess:(id <NSFastEnumeration>)allMappings {
+    for (NJOutput *o in _entries.allValues)
+        [o postLoadProcess:allMappings];
+}
+
+
 @end