X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Classes%2FNJMapping.m;h=1b05c424bfe708ab23698b07448ffea79c368eec;hp=0e67cd3469e66f3f7e6b2072b6843aa8629238a0;hb=HEAD;hpb=235c087385a6e959ba7edefe4a3cbbbc00b2a534 diff --git a/Classes/NJMapping.m b/Classes/NJMapping.m index 0e67cd3..1b05c42 100644 --- a/Classes/NJMapping.m +++ b/Classes/NJMapping.m @@ -33,15 +33,13 @@ 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; } @@ -100,11 +98,13 @@ 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]; @@ -121,8 +121,7 @@ return nil; } - return [[NJMapping alloc] initWithSerialization:serialization - mappings:mappings]; + return [[NJMapping alloc] initWithSerialization:serialization]; } - (void)mergeEntriesFrom:(NJMapping *)other { @@ -130,4 +129,10 @@ [_entries addEntriesFromDictionary:other->_entries]; } +- (void)postLoadProcess:(id )allMappings { + for (NJOutput *o in _entries.allValues) + [o postLoadProcess:allMappings]; +} + + @end