The Ruby String class is a subclass of NSString: MacRuby-0.12 irb(main):001:0> "foo".class.ancestors => [String, NSMutableString, NSString, Comparable, NSObject, PP::ObjectMixin, Kernel, RbConfig]
In order to get the list of all methods that an object responds to, including those defined in Cocoa classes, use #method(true,true): MacRuby-0.12 irb(main):003:0> "".methods(true,true).count => 763 On 21 Feb 2012, at 10:48, Chong-Yee Khoo wrote: > I'm not sure if this is the appropriate forum to post this, so please > accept my apologies if so. > > I have a slight suspicion that MacRuby is not working/not installed > properly in my machine. > > In macirb, the class of an object is always reported as the Ruby > class, not the NS class - e.g., string is always "String", when I > believe it should be NSString. > > $ macirb > irb(main):001:0> "foo".class > => String > > also > > $ ruby -ve "p ''.methods.size" > ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] > 162 > > $ macruby -ve "p ''.methods.size" > MacRuby 0.10 (ruby 1.9.2) [universal-darwin10.0, x86_64] > 162 > > when I would have expected the numbers to be higher in the second. > > Is this something that I should be concerned about? > > The curious thing is that I am working my way through Matt's book, and > the examples seem to work properly (including in Xcode, apart from the > hiccup with the recent 4.3 upgrade, which I haven't been able to > resolve yet). > > Any help would be gratefully received. Thanks in advance. System is > 10.7.3, Ruby 1.9.3, MacRuby 0.10, Xcode 4.3. > > Regards, > > Chong-Yee > _______________________________________________ > 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