Hi --

On Fri, 29 Aug 2008, RubyTalk / gmail.com wrote:

> I need help with === and Objects
>
> 270  Array === Array
>> ] false [<
> 290 Array == Array
>> ] true [<
> 300 Object === Object
>> ] true [<
> 310 Object.class
>> ] Class [<
> 320 Object === Class
>> ] true [<
>
>
> I would think that Array === Array. If not I would not expect line 300
> to be true.

Those are two very different cases, though. Given this:

    a === b

it is true if the class of b has a in its ancestry. So you can always
try:

   b.class.ancestors.include?(a)

If you plug Object/Object into that expression, you'll get true. If
you plug Array/Array in, you won't. The reason is that all objects are
instances of Object and its descendants, including the class object
Object. So Object has a unique relationship, among classes, to itself.


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!