Ruby Newbie homepage Ruby Newbie homepage

How to use

Quick guide

Official content
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.
 
               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));
}
            

Was this page useful?