In macruby what does Module's method "__type__" do? -
Thank you! z which in turn depends on the Of course, it only returns a number that matches a type identifier, as defined by the pre-compiler constant T_FIXNUM, T_FLOAT, etc. I would say that this is really some of limited use for standard users, however, when you write a C extension, it can check your code more efficient type. module macruby has several ways that are not usually. One of these is
__ type __ and I can not understand what it does. What does it do?
__ type __ is defined in object.c: < / P>
static VALUE rb_obj_type (VALUE obj) {return LONG2FIX (TYPE (obj)); }
rb_type function:
static inline Inc. rb_type (VALUE obj) {if ( IMMEDIATE_P (Obj)) {if (FIXNUM_P (obj)) {return T_FIXNUM; } If (FIXFLOAT_P (obj)) {return T_FLOAT; } If (obj == Qtrue) {return T_TRUE; } If (obj == Qundef) {return T_UNDEF; }} And if (! RTEST (obj)) {if (obj == Qnil) {return T_NIL; } If (obj == Qfalse) {return T_FALSE; }} Return rb_objc_type (obj); }
Comments
Post a Comment