Objective-c Class -> methods
Hi there! I'm having problems of getting a list of methods from Classes, declared in Objective-C. I have a class compiled, and fully working, look like this: // Vector.h @interface Vector : NSObject { float x,y,z; } @property float x,y,z; @property float length; @end // Vector.m @implementation Vector @synthesize x,y,z; -(Vector*)vectorByAdd:(Vector*)vector{ Vector* newVector=[[Vector new] autorelease]; newVector.x=self.x+vector.x; newVector.y=self.y+vector.y; newVector.z=self.z+vector.z; return newVector; } [...] @end when I call the ruby method :methods on a Vector, it returns the methods of an Object class, and I cant get neither the accesors of the x,y,z property, nor the other methods appears Once I read something about how to get the obj-c methods, but I couldn-t find it.
HI, I think for calling the .methods method from MacRuby you should add two additional MacRuby specific arguments. to get the list of all methods use this: .methods(true,true)or.methods true, true --- András Zalavári <zalavariandris@gmail.com> schrieb am So, 21.11.2010: Von: András Zalavári <zalavariandris@gmail.com> Betreff: [MacRuby-devel] Objective-c Class -> methods An: "MacRuby development discussions." <macruby-devel@lists.macosforge.org> Datum: Sonntag, 21. November, 2010 18:55 Uhr Hi there! I'm having problems of getting a list of methods from Classes, declared in Objective-C.I have a class compiled, and fully working, look like this: // Vector.h@interface Vector : NSObject { float x,y,z; } @property float x,y,z; @property float length; @end // Vector.m @implementation Vector @synthesize x,y,z; -(Vector*)vectorByAdd:(Vector*)vector{ Vector* newVector=[[Vector new] autorelease]; newVector.x=self.x+vector.x; newVector.y=self.y+vector.y; newVector.z=self.z+vector.z; return newVector; }[...] @end when I call the ruby method :methods on a Vector, it returns the methods of an Object class, and I cant get neither the accesors of the x,y,z property, nor the other methods appears Once I read something about how to get the obj-c methods, but I couldn-t find it. -----Integrierter Anhang folgt----- _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
You can pass two arguments to #methods, which are to include methods from ancestors and to include Objective-C methods, So you probably want: vector.methods(false, true) On 21 nov 2010, at 18:55, András Zalavári wrote:
Hi there!
I'm having problems of getting a list of methods from Classes, declared in Objective-C. I have a class compiled, and fully working, look like this:
// Vector.h @interface Vector : NSObject { float x,y,z; } @property float x,y,z; @property float length; @end
// Vector.m
@implementation Vector @synthesize x,y,z; -(Vector*)vectorByAdd:(Vector*)vector{ Vector* newVector=[[Vector new] autorelease]; newVector.x=self.x+vector.x; newVector.y=self.y+vector.y; newVector.z=self.z+vector.z; return newVector; }
[...] @end
when I call the ruby method :methods on a Vector, it returns the methods of an Object class, and I cant get neither the accesors of the x,y,z property, nor the other methods appears
Once I read something about how to get the obj-c methods, but I couldn-t find it.
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (3)
-
András Zalavári
-
denny trebbin
-
Eloy Duran