From: Edward Faulkner Date: 2005-09-26T10:45:53+09:00 Subject: Re: Overloading --i9LlY+UWpKt15+FH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 26, 2005 at 10:38:16AM +0900, Ben wrote: > The options I see are: >=20 > 1) Call .class.to_s on each parameter to match the type: > "pattern.class.to_s =3D~ /Array/ then # I have an array of regexp You can do this: if pattern.class =3D=3D Array # then ... Or this: case pattern when Array # handle array when Regexp # handle Regexp end Or use this to ensure that pattern is always an Array: pattern =3D [pattern] unless pattern.class =3D=3D Array -Ed --i9LlY+UWpKt15+FH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFDN1KJnhUz11p9MSARAgGuAJsFLCtlDvw5THZ0Qnt0CLczvkL+0QCg4XGy OTpjNhrp1c3D0IM7KY/TUcQ= =8JVY -----END PGP SIGNATURE----- --i9LlY+UWpKt15+FH--