>>>>> "A" == Andreas Riedl <viisi / chello.at> writes:

A> for debugging purposes i'd be fine to call the 'inspect'
A> method for these objects. 

A> sort of

A>   rb_funcall(value,rb_intern("inspect"),0);

A> works well for numbers,strings,classes, 
A> but fails for arrays & hashes.

 Can you give a complete example of failure ?


pigeon% cat tt.c
#include <ruby.h>
 
static VALUE
tt_ins(self)
    VALUE self;
{
    return rb_funcall(self, rb_intern("inspect"), 0, 0);
}
 
void Init_tt()
{
    rb_define_method(rb_cObject, "ins", tt_ins, 0);
}
 
pigeon% 

pigeon% ruby -rtt -e 'p ({1 => 2}.ins)'
"{1=>2}"
pigeon% 

pigeon% ruby -rtt -e 'p ([1 , 2].ins)'
"[1, 2]"
pigeon% 


Guy Decoux