[MacRuby-devel] Invoking a block in MacRuby, instantiated in Objective-C

Christian Niles christian at nerdyc.com
Sun May 15 13:42:35 PDT 2011


Hey All,

There's plenty of documentation showing how one can use Proc objects to invoke Objective-C methods that accept block parameters, but I can't find any way to invoke an Objective-C block from within a Ruby method.

Without thinking I had assumed they'd be mapped to a Proc-like object, which I could invoke with #call:

	def performOperation(operation, success:success_callback, error:error_callback)
		# ...
		result = "..."
		success_callback.call(result)
	end

But I get an error: undefined method `call' for #<__NSAutoBlock__:0x2006b6560>

christian.


More information about the MacRuby-devel mailing list