Method: Kernel#String
- Defined in:
- object.c
permalink #String(object) ⇒ Object
Returns a string converted from object
.
Tries to convert object
to a string using to_str
first and to_s
second:
String([0, 1, 2]) # => "[0, 1, 2]"
String(0..5) # => "0..5"
String({foo: 0, bar: 1}) # => "{foo: 0, bar: 1}"
Raises TypeError
if object
cannot be converted to a string.
3860 3861 3862 3863 3864 |
# File 'object.c', line 3860
static VALUE
rb_f_string(VALUE obj, VALUE arg)
{
return rb_String(arg);
}
|