Hi -- On Fri, 2 Nov 2007, Gabriel Dragffy wrote: > Hi all, > > I have an object ( a website tester) that can return various values. One of > which is Net:HTTPOK, I want to use a case statement to evaluate this and set > a variable called 'severity', as follows: > > result = TestWebsite::test( site ) > case result > when Net::HTTPOK > severity = :INFO > when SocketError > severity = :ERROR > else > severity = :WARN > end > > However, when Net::HTTPOK is returned, the severity variable ALWAYS ends up > as :WARN instead of :INFO. > > Using IRB I have manually entered the code in as follows: >>> site = 'beautyandthebrand.co.uk' > => "beautyandthebrand.co.uk" >>> result = TestWebsite::test( site ) > => Net::HTTPOK > > Then ran the following tests: >>> result == Net::HTTPOK > => true >>> result != Net::HTTPOK > => false > > This to me just proves the result I am getting is Net::HTTPOK, but why can't > I get it to match in the case statement? The test that the case statement is running is this: Net::HTTPOK === result # note the order, and the 3 equal signs I don't know exactly what Net::HTTPOK is, or how it handles ===, but evidentally it doesn't consider itself "threequal" to result. David -- Upcoming training by David A. Black/Ruby Power and Light, LLC: * Advancing With Rails, Edison, NJ, November 6-9 * Advancing With Rails, Berlin, Germany, November 19-22 * Intro to Rails, London, UK, December 3-6 (by Skills Matter) See http://www.rubypal.com for details!