Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Symbol#[]
symbol[index] → string or nil
symbol[start, length] → string or nil
symbol[range] → string or nil
symbol[regexp, capture = 0] → string or nil
symbol[substring] → string or nil
string.c
View on GitHub ↗
static VALUE
sym_aref(int argc, VALUE *argv, VALUE sym)
{
return rb_str_aref_m(argc, argv, rb_sym2str(sym));
}
Equivalent to symbol.to_s[]; see String#[].