From: Marcello Barnaba Date: 2007-02-15T04:47:56+09:00 Subject: Re: Drying a ternary condition Hi, On Wednesday 14 February 2007 20:30, Robert Klemme wrote: > 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 ) I like it: i was trying to achieve the same semantics with fewer :up symbols. Furthermore, avoiding the ?: operator is an added benefit for readability. thank you -- pub 1024D/8D2787EF 723C 7CA3 3C19 2ACE 6E20 9CC1 9956 EB3C 8D27 87EF