From: ts Date: 2000-09-28T13:49:07+09:00 Subject: [ruby-talk:5170] Re: Types and === >>>>> "B" == Brian F Feldman writes: >> class String >> alias_method '_===', '===' >> >> def ===(other) >> case other >> when Regexp >> other === self >> else >> _===(other) >> end >> end >> end B> Since this won't work, Personnally, I think this is the right way to do it. Unfortunately in this example a poor choice was made for the name of the alias method because ruby interpret _===(other) as _().===(other) i.e. it will try to call the method `_' and if this method return a string it will enter in an infinite loop. If you replace `_===' with, for example, `eqq' it will work. Guy Decoux