Accessing objc methods aliased by ruby methods
For example, the method 'class' is present in objective C as well as in Ruby but invoking obj.class will use the Ruby version How do I force the objc version to be used instead? Obviously if the two version do the same thing then this is a moot issue but if they do different things you may need to choose the 'hidden' version. Thanks, Dave.
Hi Dave, #class is really a corner case here, we force the Ruby version when calling it from Ruby because it's slightly different than the Cocoa version. (+[NSObject class] returns self, while Ruby expects Module or Class to be returned). If you want to use the Cocoa version, you can use -performSelector:. All other methods are unified, so you should never have the problem of choosing which version you want to call. As an example, String#size is implemented in MacRuby core, but String#length is simply -[NSString length], implemented in Foundation. Laurent On May 6, 2010, at 12:05 PM, Dave Baldwin wrote:
For example, the method 'class' is present in objective C as well as in Ruby but invoking obj.class will use the Ruby version How do I force the objc version to be used instead? Obviously if the two version do the same thing then this is a moot issue but if they do different things you may need to choose the 'hidden' version.
Thanks,
Dave.
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (2)
-
Dave Baldwin
-
Laurent Sansonetti