From: Ryan Davis Date: 2008-08-31T10:31:38+09:00 Subject: Re: Simple conditional causing hanging? On Aug 30, 2008, at 17:12 , Will Dresh wrote: > I have the following conditional inside a method: > > if ( @thisLine.class != 'NilClass' ) > return @thisLine.class.to_s > else > return 'nope' > end This code is a complete mess. Simplify Simplify Simplify. return @thisLine ? @thisLine.class.name : 'nope' or even: return if @thisLine then @thisLine.class.name else 'nope' end tho, I will say, that returning the class name is bad design smell to begin with. Returning 'nope' as your alternative is even worse. > There is _nothing_ about your code that would cause a hang by calling #to_s on a class. Something else entirely is going on.