[MacRuby-devel] rubyfying Cocoa iterators

Daniel Westendorf daniel at prowestech.com
Wed Nov 16 07:07:19 PST 2011


Give it some ruby love! I found this somewhere in the interwebs to iterate
over an NSIndexSet, which should be similar. https://gist.github.com/1370277

dw

On Wed, Nov 16, 2011 at 3:11 AM, Jean-Denis MUYS <jdmuys at kleegroup.com>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 at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20111116/c88594e0/attachment.html>


More information about the MacRuby-devel mailing list