From: Robert Klemme Date: 2010-10-21T04:40:13+09:00 Subject: Re: Long conditional statements On 20.10.2010 20:37, Courtland Allen wrote: > On Wed, Oct 20, 2010 at 11:25 AM, Robert Klemme > wrote: >> Courtland, can you demonstrate a real example of your complex conditions? >> Maybe there are other ways to transform them and make them less complex. > It happens in a variety of different ways in my code, so the more techniques > you guys list, the better (I hadn't known about any?). > > But here's one example anyway: > > if somehash[:key1].blank? or somehash[:key2].blank? >> or somehash[:key2].blank? or somehash[:key2].blank? > > doSomething() > > end if [:key1, :key2].any? {|k| somehash[k].blank?} do_something end Not much of an improvement though. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/