Jonathan Paisley
jp-ww****@dcs*****
Fri Feb 24 00:24:44 JST 2006
> > module_eval %Q! ns_override "#{sel}" !, __FILE__, __LINE__ Since the 'method_added' method itself is called from the context of the class, is it perhaps sufficient to just call ns_override directly? i.e. def method_added(sym) ... # your existing code ns_override sel end > I found a bug of overriding at testing. > > Steps to Reproduce > > (1) override with ns_override a method twice(or more) > (2) invoke super_method > => NSInvalidArgumentException - *** -[NSProxy forwardInvocation:] > called! Excellent. Earlier today Tim Burks noted that calling ns_override if there isn't an existing ObjC method defined causes an exception (he found this when switching a base-class implementation between Ruby and ObjC). Arguably this is an exceptional case. I think that with the method_added hook we can treat that problem as resolved too, since people shouldn't need to use ns_override any more.