On May 27, 2007, at 7:24 AM, Stefan Rusterholz wrote:

> Erwin Abbott wrote:
>> case x
>> when Array puts "Array"
>> when Proxy puts "Proxy"
>> end
>
> Ugly, but you could try:
> puts case [x.class]
>   when [Array]: "Array"
>   when [Proxy]: "Proxy"
>   else "Hu?"
> end
>
> Regards
> Stefan


	case uses === to match when clauses. Therefor you can do it like this:

case x
when Array
   puts "Array"
when Proxy
   puts "Proxy
end

Cheers-

-- Ezra Zygmuntowicz 
-- Lead Rails Evangelist
-- ez / engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)