[MacRuby-devel] Accessing objc methods aliased by ruby methods

Laurent Sansonetti lsansonetti at apple.com
Thu May 6 16:57:23 PDT 2010


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 at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list