fix.id2name → string or nil
Returns the name of the object whose symbol id is fix. If there is no symbol in the symbol table with this value, returns nil. id2name has nothing to do with the Object.id method. See also Fixnum#to_sym, String#intern, and class Symbol.
symbol = :@inst_var #=> :@inst_var id = symbol.to_i #=> 9818 id.id2name #=> "@inst_var"
Source Code
/* * call-seq: * fix.id2name -> string or nil * * Returns the name of the object whose symbol id is <i>fix</i>. If * there is no symbol in the symbol table with this value, returns * <code>nil</code>. <code>id2name</code> has nothing to do with the * <code>Object.id</code> method. See also <code>Fixnum#to_sym</code>, * <code>String#intern</code>, and class <code>Symbol</code>. * * symbol = :@inst_var #=> :@inst_var * id = symbol.to_i #=> 9818 * id.id2name #=> "@inst_var" */ static VALUE fix_id2name(fix) VALUE fix; { char *name = rb_id2name(FIX2UINT(fix)); if (name) return rb_str_new2(name); return Qnil; }
<code/>and<pre/>for code samples.