End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Symbol#<=>
<=>(p1)
string.c
View on GitHub ↗
static VALUE
sym_cmp(VALUE sym, VALUE other)
{
if (!SYMBOL_P(other)) {
return Qnil;
}
return rb_str_cmp_m(rb_sym2str(sym), rb_sym2str(other));
}
symbol <=> other_symbol -> -1, 0, +1, or nil
Compares symbol with other_symbol after calling to_s on each of the symbols. Returns -1, 0, +1, or nil depending on whether symbol is less than, equal to, or greater than other_symbol.
nil is returned if the two values are incomparable.
See String#<=> for more information.