From: Navindra Umanee Date: 2005-03-14T04:18:39+09:00 Subject: Re: how do you duck-type something to String, so String believes you? > What you can do is override String.== to take this into consideration. > > class String > alias :_equals :== > def ==(o) > _equals(o.to_s) > end > end ES is right, you don't need to redefine == in String if you do it in Str. I didn't notice that str1 and str2 were swapped around in the call to rb_equal. if (TYPE(str2) != T_STRING) { if (!rb_respond_to(str2, rb_intern("to_str"))) { return Qfalse; } return rb_equal(str2, str1); } Clever. :-) Cheers, Navin.