[MacRuby-devel] Invoking an obj-c method requiring a block

Andy Park sohocoke at gmail.com
Sat Aug 20 14:52:03 PDT 2011


I tried using blocks today, to no avail.

This didn't work:
		NSNotificationCenter.defaultCenter.addObserverForName "kDocSetSelection
Changed", object:nil, queue:nil, usingBlock:Proc.new{ |notification|
			NSLog("notified")
		}

But this did:
		NSNotificationCenter.defaultCenter.addObserver(self, selector: "handleM
e:", name: "kDocSetSelectionChanged", object: nil)

I found http://www.macruby.org/trac/ticket/760 that hinted MacRuby does impleme
nt blocks, but also had references to BridgeSupport. I installed the preview-3 
version; what would be the reason the above didn't work?

Thanks.



More information about the MacRuby-devel mailing list