From: Ryan Pavlik Date: 2003-08-12T12:10:49+09:00 Subject: Re: using case with classes On Tue, 12 Aug 2003 10:25:04 +0900 Michael Garriss wrote: > Ok, this did not work like I expected (because I know too little about > Ruby): > > def test( obj ) > case obj.class > when Array then puts "Array" > when Hash then puts "Hash" > when Class then puts "Class" > else puts "ugh" > end > end try this: def test( obj ) case obj when Array then puts "Array" when Hash then puts "Hash" when Class then puts "Class" else puts "ugh" end end Unfortunately the behavior above is still annoying; in this case you have an object to work with, but I've run into a number of cases where I have only a class, and I just have to use a big "if" block. -- Ryan Pavlik "These burnt fries are comin' out of *your* check Mr. Ninja!" - 8BT