From: eden li Date: 2006-10-12T17:20:20+09:00 Subject: Re: Does case/when really use ===? Got it. This question came up because I was dealing with a library that has wrapped a proxy class around an Array that intercepted methods to make it appear as if that class is actually an Array class (rails' AssociationProxy for those counting). Because I'm not native in Ruby, I spent a good deal of time debugging a particular case/when statement. This proxy class undefines all non-critical instance method (ie, ones that Ruby does not throw an error for when you call undef_method on them) and passes them to an internal instance variable on method_missing. This makes it seem like an object of this proxy class look like an instance of its internal variable, but only until you pass it to the case/when construct. This makes me wonder how the proxy class could be rewritten to make case/when operate on that internal variable. Is rewriting the Class.=== method to special-case the proxy class the only way to accomplish this? Ken Bloom wrote: > === is not commutative (nor is it intended to be), and it actually gets > called in the other direction (the call it makes is String === C.new)