From: "shortcutter@..." Date: 2008-05-28T23:16:32+09:00 Subject: Re: The duck's backside On 28 Mai, 15:14, Tobias Weber wrote: > In article > <9560F017-58CA-48EB-BCC3-3B1675851...@games-with-brains.com>, > Eleanor McHugh wrote: > > > > uaid = "ignore" > > Ups, shoulda been c = > > > @post("first=#{a}&second=#{b.to_int}&third=#{c.to_int}") > > Won't work as the web service actually expects either a number or the > string "ignored" You can do @post("first=#{a}&second=#{b.to_int rescue 'ignored'}&third=#{c.to_int rescue 'ignored'}") Of course, defining a method for this would be better. How about: def intify(x) x.to_int rescue "ignored" end def doit(a, b, c = nil) (b, c = intify(b), intify(c)).select {|x| Numeric === x}.size != 1 and raise ArgumentError, "need exactly one number" @http.post("first=#{a}&second=#{b}&third=#{c}") end Cheers robert