From: Robert Klemme Date: 2007-02-15T04:30:06+09:00 Subject: Re: Drying a ternary condition On 14.02.2007 19:18, Marcello Barnaba wrote: > How would you write the following statement: > > klass.send((ARGV[0] || :up).to_sym == :up ? :up : :down) The only idea I have so far is longer but less complex structured IMHO: klass.send( case ARGV[0] when "up", nil then :up else :down end ) This one is even better: klass.send( ARGV[0] || "up" == "up" ? :up : :down ) Dunno what you like more... robert