From: "Brian F. Feldman" Date: 2000-09-26T14:23:45+09:00 Subject: [ruby-talk:5128] Re: Types and === > class String > alias_method '_===', '===' > > def ===(other) > case other > when Regexp > other === self > else > _===(other) > end > end > end Since this won't work, and neither does my previous suggestion work correctly (*g*), here's one which does. The only problem is that it can only be done one level deep or you'll need more unique variable names (and I'm having problems making just that work :( ) This makes me wish there was something like "super", but for redefining methods in-place. Then again, the clean way to do this would be to implement a new class and use "super" anyway, I guess. class String private OldString = String.dup public def ===(other) if other.is_a? Regexp return other === self end return OldString.new(self) === other end end -- Brian Fundakowski Feldman \ FreeBSD: The Power to Serve! / green@FreeBSD.org `------------------------------'