End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
String#b
str.b → str
string.c
View on GitHub ↗
static VALUE
rb_str_b(VALUE str)
{
VALUE str2;
if (FL_TEST(str, STR_NOEMBED)) {
str2 = str_alloc_heap(rb_cString);
}
else {
str2 = str_alloc_embed(rb_cString, RSTRING_EMBED_LEN(str) + TERM_LEN(str));
}
str_replace_shared_without_enc(str2, str);
ENC_CODERANGE_CLEAR(str2);
return str2;
}
Returns a copied string whose encoding is ASCII-8BIT.