Timothy Bennett
3/23/2006 2:59:00 AM
case uses === for comparison, not ==
In my irb, Fixnum === 5.class => false
As for why === gives false, I have no idea. In the mean time, you
could use
case a.class.to_s
when "Fixnum"
puts ....
else
puts ....
end
Tim
On Mar 22, 2006, at 6:51 PM, Joe Van Dyk wrote:
> a = 5
> puts Fixnum == a.class # spits out true
>
> # spits out "Who knows what I am. :-("
> case a.class
> when Fixnum
> puts "I'm a fixnum!"
> else
> puts "Who knows what I am. :-("
> end
>
>
> What's going on here?
>
> Joe
>