[MacRuby-devel] C-level blocks (issue #712)?

Laurent Sansonetti lsansonetti at apple.com
Sun Jan 9 14:22:23 PST 2011


Hi Rolando,

The syntax is simple, you simply pass a Proc project.

Here is an example:

	framework 'Foundation'
	a = [1, 2, 3, 4, 5]
	a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop|
		p obj
		stop.assign(true) if index == 2
	})

It looks like the snippet you pasted should just work. Did you find a problem?

Laurent

On Jan 9, 2011, at 8:09 AM, Rolando Abarca wrote:

> Hi all,
> 
> I've taken a look at the referred issue (#712), but I'm not sure of
> the final implemented syntax. I'm trying to use a NSOpenPanel, so far
> this is what I'm doing:
> 
> 
> {{{
>  def loadSprite(sender)
>    @panel.beginSheetModalForWindow(@window, completionHandler:lambda { |code|
>      NSLog("code: #{code}")
>    })
>  end
> }}}
> 
> what's the Right Way(tm) to use a NSOpenPanel?
> thanks!
> -- 
> Rolando Abarca M.
> Games For Food S.p.A.
> http://www.gamesforfood.com
> Phone: +1 (408) 345-5433
> _______________________________________________
> 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/20110109/d9916c3a/attachment.html>


More information about the MacRuby-devel mailing list