In article 
<9560F017-58CA-48EB-BCC3-3B16758516C1 / games-with-brains.com>,
 Eleanor McHugh <eleanor / games-with-brains.com> 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"

> This makes the exclusion of b and c more explicit, which will make it  

First I actually tried exclusive or, but that operates bit-wise on 
Integer so the results were strange.

I've always been very comfortable with perl's boolean logic, so I have 
to relearn some tricks.

(in Ruby 0 and "" are true)

> achieve, however this kind of belt-and-braces approach suggests that  
> you're tackling the problem from the wrong angle and should look at  
> the data-flow elsewhere in your code.

So that doit() is only passed legal values? That should be the case, but 
I want to make extra sure not to give that foreign web service something 
it can't swallow.

> 	def doit a, v, param = :second
> 		raise ArgumentError, "needs a numeric value" unless v.respond_to? 
> (:to_int)
> 		v = "ignore" if (param == :third) && v > 0

That is essentially overloading doit() for first or second parameter, 
and a good idea! So far I just wrapped the http calls in convenience 
methods one by one.

-- 
  Tobias Weber