Howdy,

I've Core Data a lot in Objective-c and now I am trying to use it in MacRuby. 
It occurs to me that I might need to create the to-many relationship accessors 
just like you have to do in Objective-C. 

To clarify: Suppose I have a data model that models a file structure and which 
looks like this:

Folder{
  name:string
  parent<<-->Folder.subFolders
  subFolders<-->>Folder.parent
  files<-->>File.folder
}
File{
  name:string
  folder<<-->Folder.file
}

In Objective-C, I would normally have methods in the `Folder` class that would 
look like:

addSubFoldersObject:
removeSubFoldersObject:
addSubFoldersObjects:
removeSubFoldersObjects:

The methods themselves would use look something like:

- (void)addSubFoldersObject:(FetchedPropertyExtractor *)value {    
    NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
    [self willChangeValueForKey:@"SubFolders" 
withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [[self primitiveValueForKey:@"SubFolders"] addObject:value];
    [self didChangeValueForKey:@"SubFolders" 
withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [changedObjects release];
}

Do you have to do the same thing in MacRuby or will the normal ruby set 
operations suffice?

Thanks,
Shannon Love a.k.a TechZen


_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to