Robert Klemme wrote:
> Just for the sake of completeness: obj.kind_of? Customer is equivalent to
> Customer === obj while obj.class == Customer has different semantics.  The
> latter form test for the exact class only while both former variants test
> for classes and sub classes.

....and since testing for a specific class prohibits substituting in 
derived classes, and hence removes a lot of the power of dynamic OO 
programming, it's best to use kind_of? --unless you have a real need to 
check for only the precise class specified.

And it's often better still to use respond_to? to check for the specific 
behaviors you need, and get the benefits of Duck Typing, rather than 
check for classes.


mathew