[MacRuby-devel] Converting Ruby-style method signatures back to Obj-C style

Laurent Sansonetti lsansonetti at apple.com
Mon Oct 18 16:27:03 PDT 2010


Hi Gabriel,

There isn't any way to reconstruct the objc selector. We could expose an API, though, if you file a ticket, but I suspect it's not hard to do.

Laurent

On Oct 15, 2010, at 2:34 PM, Gabriel Gilder wrote:

> Hi all,
> 
> I have a somewhat esoteric problem and I was wondering if anyone had suggestions about how to deal with it.
> 
> Basically I'm writing a Ruby class that wraps some Objective-C classes and provides a common interface to them, and I'm using method_missing to pass along messages if the wrapped object understands them. This works great for simple methods that don't have named parameters. However, by the time a call hits method_missing, MacRuby has already converted the method signature to a Ruby-style call.
> 
> For example, one object I'm wrapping has a method "doScript:in:" - but by the time that hits method_missing I have a method with signature "doScript:" and a list of arguments like "script, {:in => target}".
> 
> Now of course, I can add some logic to my method_missing handler to check if the second param is a Hash and reconstruct the Obj-C method signature from that. I'm just wondering if MacRuby provides a built-in way to do that, or if I'm missing an easier way to handle this...
> 
> Any input appreciated!
> 
> Thanks,
> -Gabriel
> 
> 
> _______________________________________________
> 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/20101018/cd31e462/attachment-0001.html>


More information about the MacRuby-devel mailing list