Method: Object#to_s
- Defined in:
- object.c
#to_s ⇒ String
Returns a string representing obj. The default #to_s prints the object’s class and an encoding of the object id. As a special case, the top-level object that is the initial execution context of Ruby programs returns “main”.
653 654 655 656 657 658 659 660 661 662 |
# File 'object.c', line 653
VALUE
rb_any_to_s(VALUE obj)
{
VALUE str;
VALUE cname = rb_class_name(CLASS_OF(obj));
str = rb_sprintf("#<%"PRIsVALUE":%p>", cname, (void*)obj);
return str;
}
|