Agreed, it wasn't difficult. I posted a gist with the solution I came up with:
http://gist.github.com/633608 I'd love any feedback if I'm doing this in a nonsensical way. :) -Gabriel On Mon, Oct 18, 2010 at 4:27 PM, Laurent Sansonetti <lsansone...@apple.com>wrote: > 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@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > > > > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > >
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel