From: Intransition Date: 2010-02-22T21:29:15+09:00 Subject: Re: Complex type-checking On Feb 21, 10:43 pm, Ken Coar wrote: > I have a number of methods that can take arguments in two different > forms.  As an example: > > method(tuple [, ...]) > > where 'tuple' can be things like (Point, Point, Integer) or (Numeric, > Numeric, Numeric, Numeric, Integer) (so either a Point object > representing the coordinates, or the coordinates directly). > > I realise that type-checking in Ruby is anathematic to some, but I want > to generate some intelligent error messages in some cases.  So please > let's leave the 'why do you want to do that' bit alone for now. :-) Let the error happen then wrap the call in a begin/rescue clause and give more intelligent error messages based on the return error.