[MacRuby-devel] rubyfying Cocoa iterators

Jean-Denis MUYS jdmuys at kleegroup.com
Wed Nov 16 02:11:27 PST 2011

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?



More information about the MacRuby-devel mailing list