On 28 May 2008, at 18:57, Mark Wilden wrote:
> On May 28, 2008, at 8:24 AM, Eleanor McHugh wrote:
>> 	doit a, b, c = nil
>> 		raise ArgumentError, "needs exactly one additional argument" if b  
>> && c
>> 		v = b || c
>> 		raise ArgumentError, "need a numeric parameter" unless  
>> v.respond_to?(:to_int)
>> 		@post "first=#{a}&" + (b.nil? ? "second=ignored&third=#{v}" :  
>> "second=#{v}&third=ignored")
>> 	end
>
> This looks like a great solution!
>
> But if you want to check for numeric parameters, would it be better  
> just to use Numeric === v ? I know this isn't the ducky way, but it  
> certainly seems more "intentional."

That'd be marginally more readable but to my mind it's overly  
cautious: what's the point of using Ruby if you're still going to  
follow static typing conventions?

Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net
----
raise ArgumentError unless @reality.responds_to? :reason