Method: Range#to_s

Defined in:
range.c

#to_sString

Convert this range object to a printable form (using #to_s to convert the begin and end objects).

Returns:

[View source]

1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
# File 'range.c', line 1422

static VALUE
range_to_s(VALUE range)
{
    VALUE str, str2;

    str = rb_obj_as_string(RANGE_BEG(range));
    str2 = rb_obj_as_string(RANGE_END(range));
    str = rb_str_dup(str);
    rb_str_cat(str, "...", EXCL(range) ? 3 : 2);
    rb_str_append(str, str2);

    return str;
}