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

Gabriel Gilder gabriel.gilder at gmail.com
Fri Oct 15 14:34:58 PDT 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20101015/de0f5f8d/attachment.html>


More information about the MacRuby-devel mailing list