Florian Gilcher
3/27/2008 12:31:00 PM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mar 27, 2008, at 10:34 AM, =D0=98=D0=B2=D0=B0=D0=BD =
=D0=95=D0=B2=D1=82=D1=83=D1=85=D0=BE=D0=B2=D0=B8=D1=87 wrote:
>
>
> So you can do something like this
> def test(arg)
> if arg.is_a?(String)
> else
> end
> end
>
There are some projects out there that allow pattern matching on =20
arguments to some extend. (search for "match" on rubyforge)
Basically, they work by defining a proxy method that does the pattern =20=
matching and then calling some predefined procs. Essentially,
they define this test-Method dynamically.
This is not overloading in a strict sense, but it comes close.
Greetings
Florian Gilcher
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
iEYEARECAAYFAkfrk3MACgkQJA/zY0IIRZZImgCeLw1Db8i/wyhlNP+0jrlXpjUD
RaUAn0ecOSw8Qd5wOzmwI/LHkL5rBncb
=3D/pKG
-----END PGP SIGNATURE-----