1 Oct 02:32
[ruby-core:19059] Ruby class name from C extensions
From: Joe Damato <ice799 <at> gmail.com>
Subject: [ruby-core:19059] Ruby class name from C extensions
Newsgroups: gmane.comp.lang.ruby.core
Date: 2008-10-01 00:32:19 GMT
Subject: [ruby-core:19059] Ruby class name from C extensions
Newsgroups: gmane.comp.lang.ruby.core
Date: 2008-10-01 00:32:19 GMT
Hi - If I have ruby source that looks like this: class Test def .... end and in a ruby C extension I have something like: fprintf(stderr, "class name: %s\n", RSTRING(rb_class_path(obj->as.basic.klass))->ptr); I get output like this: class name: #<Class:0xb7e1158> Why doesn't it output something like: #<Test:0x...> ? There are two possibilities: either I am not using the correct obj struct or I am misusing/misunderstanding rb_class_path(). I am fairly certain I am using the correct struct, so I am probably misunderstanding how rb_class_path and related functions work -- is there a function I can call that if I pass in a klass or a VALUE it will return either a c string or an RSTRING that contains the class name? Any other hints or advice is greatly appreciated. Thanks, Joe
RSS Feed