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 <samatoms / gmail.com>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/.
>
>