Le 1 juin 04, ? 23:44, Luke A. Kanies a ?crit :

> If I run the following code:
>
> if Hash === Hash
>     puts "yup"
> end

irb(main):001:0> Hash == Hash
=> true
irb(main):002:0> Hash === {}
=> true

== tests the equality of two object. The fact that they are referred to 
by constant is irrelevant:

irb(main):001:0> h = Hash
=> Hash
irb(main):002:0> h == {}.class
=> true

The === operator is used with the case .. when construct and it is a 
cool idea. For a module (or class), it is equivalent to kind_of?: Hash 
=== {} is equivalent to {}.kind_of?({}).

See the pickaxe.

Guillaume.