From: Daniel Carrera Date: 2003-06-27T13:47:17+09:00 Subject: Re: method overloading? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Does this help?: def my_method(*args) if args.length == 2 two_parameters_method(args) elsif args.length == 3 three_parameters_method(args) end end On Fri, Jun 27, 2003 at 01:43:42PM +0900, Donglai Gong wrote: > Is there a way to implement method overloading in ruby? Naively I just > defined two methods with the same name with different number of > parameters...Ruby didn't like that. > > Donglai > - -- Daniel Carrera | OpenPGP fingerprint: Graduate TA, Math Dept | 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88 UMD (301) 405-5137 | http://www.math.umd.edu/~dcarrera/pgp.html -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (SunOS) iD8DBQE++8xOnxE8DWHf+OcRAl4DAKDRbjvOrfMXCThfwDS2ByiyuuxsbwCeLJNT kqbKGOYm5OUjay6wiiHtwjU= =kyCD -----END PGP SIGNATURE-----