Hello!
I want to get the class of an object through the Ruby C API.
Actually, I want what foo.class does.
I tried:
foo = STR2CSTR(rb_iv_get(self, "@class"));
but it doesn’t work.
I also tried:
foo = rb_obj_as_string(rb_obj_class(self));
which it seems to work, but it produces a strange output:
% ruby gen.rb
gen.rb:11: warning:
Foo
(Notice the '\n’s after warning:)
Is there another better way? (Okay I can replace '\n’s but it
seems to me that I’m following the wrong way).
Regards,
···
–
University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky
VALUE foo;
char *name;
name = rb_class2name(CLASS_OF(foo));
···
On Thu, 27 Nov 2003 05:42:22 +0900, Elias Athanasopoulos wrote:
Hello!
I want to get the class of an object through the Ruby C API. Actually, I
want what foo.class does.
That was the trick. Thanx. Apologies for my delayed answer.
Regards,
···
On Thu, Nov 27, 2003 at 06:52:11AM +0900, Tim Hunter wrote:
On Thu, 27 Nov 2003 05:42:22 +0900, Elias Athanasopoulos wrote:
Hello!
I want to get the class of an object through the Ruby C API. Actually, I
want what foo.class does.
VALUE foo;
char *name;
name = rb_class2name(CLASS_OF(foo));
–
University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky