==(p1)
  public
  
    
    
Equality—Returns whether str == obj, similar to
Object#==.
If obj is not an instance of String but
responds to to_str, then the two strings are compared using
obj.==.
Otherwise, returns similarly to String#eql?, comparing length and content.
   
  
    Show source    
    
      VALUE
rb_str_equal(VALUE str1, VALUE str2)
{
    if (str1 == str2) return Qtrue;
    if (!RB_TYPE_P(str2, T_STRING)) {
        if (!rb_respond_to(str2, idTo_str)) {
            return Qfalse;
        }
        return rb_equal(str2, str1);
    }
    return str_eql(str1, str2);
}