------ art_37149_27708222.1165223337141 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I prefer this method if I have many parameters, and when I have just fewer parameters I prefer Austin Ziegler's method. Thanks : ) 2006/12/4, Max Muermann <ruby / muermann.org>: > > On 12/4/06, Yang Bob <bob.yang.dev / gmail.com> wrote: > > But how about overloading by parameter numbers. such as: > > class FooClass { > > def foo(first){ } > > def foo(first, second) { } > > } > > > > does ruby support this ? if can not, how can we workaround this? > > > > thanks > > > > There's also this one: > > def foo opts > if opts[:some_parameter] > do_something_with_parameter > end > > if opts[:some_other_parameter] > do_something_with_other_parameter > end > end > > foo :some_parameter23, :some_other_parameter abc' > > This is used as a substitute for 'true' named parameters. It is mostly > useful if you need to take a moderate number of entirely optional > parameters. > > Cheers, > Max > > ------ art_37149_27708222.1165223337141--