With the case...when construct, the class of the object is already
being checked. Therefore, your first form should be:
case :foo
when Symbol then
  puts 'yes'
else
  puts 'no'
end

By adding the .class to the :foo, the construct is actually checking
the class of :foo.class, which is Class, so you fall through to the
'no' case.

-Patrick

On 8/19/05, Daniel Schierbeck <daniel.schierbeck / gmail.com> wrote:
> Could anyone explain to me why this isn't working?
> 
>         # returns 'no'
>         case :foo.class
>           when Symbol then
>             puts 'yes'
>           else
>             puts 'no'
>         end
> 
> .... when this does
> 
>         # returns 'yes'
>         case :foo.class.object_id
>           when Symbol.object_id then
>             puts 'yes'
>           else
>            puts 'no'
>         end
> 
> I'm puzzled...
> 
> 
> Thank you in advance,
> Daniel Schierbeck
> 
>