From: "David A. Black" Date: 2008-08-29T09:59:01+09:00 Subject: Re: Class === Hi -- On Fri, 29 Aug 2008, Patrick Doyle wrote: > and I would also like to know why > > x = Array.new() > => [] > x === Array > => false Because the instance method Array#=== is not defined as a test of class membership. I believe it's the default ===, which is the same as ==. > I've just got to teach to use: > > case x > when Array > ... > end > > instead of > if x === Array > ... > end > > ...the few times I want to do something only when x is an array. You can do: if Array === x === is the case equality operator, so this: case obj when x is like this: if x === obj David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with Rails January 19-22 Fort Lauderdale, FL See http://www.rubypal.com for details and updates!