The Cbjective-C way to handle this would be to put a category that provided an `each` method on NSOrderedSet. Then when you called `each` it would just work. Ruby has a similar functionality but I can't remember right now what it's called. Using a category would be optimal in the case of Core Data because in some instances you can actually evoke a method as part of a key path when sending Key-Value messages. Shannon On Nov 16, 2011, at 4:11 AM, Jean-Denis MUYS wrote:
I have this ordered Core Data to-many relation named "operations" that I want to iterate over. I wrote:
self.operations.each { | operation | operation.doSomething }
However this fails because self.operations returns an NSOrderedSet and NSOrderedSet doesn't have an 'each' method.
I was able to use the 'enumerateObjectsUsingBlock' method of NSOrderedSet which is working fine.
My question is: what would be the MacRuby way to add an 'each' method to NSOrderedSet?
Thanks,
Jean-Denis
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel