From: Andrew Wagner Date: 2010-08-15T21:28:41+09:00 Subject: Re: Help with too many methods --0015175d053c0c3cdd048ddbdb47 Content-Type: text/plain; charset=UTF-8 Here's one approach: def get(name,value) url_method_name = "create_#{name}".to_sym method = # look up create_xxx method, I can't recall the syntax for this method.call(value) end On Sun, Aug 15, 2010 at 6:25 AM, Samuel Sternhagen wrote: > I am writing a Ruby program that creates different URL queries. Right > now I have way too many methods to achieve this. Is there a way to do > this in Ruby to eliminate the need for so many methods? > > Each of these method calls a create_url method that concatenates a > string representing the URL. > > like this: > > def getUse(username) > create_url(username) > end > > def getPage(page) > create_url(page) > end > > There are like 150 - 200 methods like this. > > could you spare a paradigm? > > Sam > -- > Posted via http://www.ruby-forum.com/. > > --0015175d053c0c3cdd048ddbdb47--