From: Josh Cheek Date: 2010-04-19T16:34:35+09:00 Subject: Re: Life without Method Overloading? --000e0cd1ab6afa454e048491fdef Content-Type: text/plain; charset=ISO-8859-1 On Mon, Apr 19, 2010 at 12:53 AM, Derek Cannon wrote: > How do Ruby programmers handle method overloading? In Java, I could > easily create several methods of the same name that accept a variety of > input. > > I know in Ruby, using *args you can accept an unlimited number of > parameters. Do I just this with a series of if statements? > > Or is there a common way Ruby programmers handle this? > > Thanks again, > Derek > -- > Posted via http://www.ruby-forum.com/. > > An easy thing to do is just normalize the data. def join_strings(a,b) a.to_s + b.to_s end join_strings 'a' , 'b' # => "ab" join_strings 1 , 2 # => "12" --000e0cd1ab6afa454e048491fdef--